Calling functions in a Lua table from C++
snippet in lua

Calling functions in a Lua table from C++

user7389

lua_getglobal(L, "banana"); // or get 'banana' from person:Eat()
lua_getfield(L, -1, "chew");
lua_pushinteger(L, 5);
lua_pcall(L, 1, 0, 0);