Reputation: 7923
I am having some trouble calling Lua functions from C++ using LuaBridge. The idea is that I want to call "Update" on the script on every game update in C++. The following code is what I have found online:
LuaRef sumNumbers = getGlobal(L, "sumNumbers");
int result = sumNumbers(5, 4);
So in my case this would be:
LuaRef updateFunction = getGlobal(L, "Update");
updateFunction();
However, the getGlobal
does not seem to exist in LuaBridge 2.0 (luabridge
namespace). This is different from the lua_getglobal
I am wondering if this has been replaced by a different function call or if it has been deprecated out of the 2.0 version. I can of course use the normal C Lua approach, but I was wondering if this has been abstracted in LuaBridge (to make things easier)
Upvotes: 0
Views: 1596
Reputation: 20858
Make sure you're using the latest source from the github project repository. When I tested this from luabridge's master branch, luabridge::getGlobal
is present and working.
Upvotes: 0