Call Lua function from C++ using LuaBridge

admin

Administrator
Staff member
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 <a href="https://eliasdaler.wordpress.com/2014/07/18/using-lua-with-cpp-luabridge/" rel="nofollow">found online</a>:

Code:
LuaRef sumNumbers = getGlobal(L, "sumNumbers");
int result = sumNumbers(5, 4);

So in my case this would be:

Code:
LuaRef updateFunction = getGlobal(L, "Update");
updateFunction();

However, the
Code:
getGlobal
does not seem to exist in LuaBridge 2.0 (
Code:
luabridge
namespace). This is different from the
Code:
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)