GameDev.net - An Introduction to Lua - 1 views
-
-
metacipher on 13 Oct 07This is seemingly out of date (4.0 perhaps). But, a lot of the logic will still work. There is no example in this article for calling a Lua function. You can do it simply by: lua_getglobal(Lua_Handle, "myfunction"); if(lua_pcall(Lua_Handle, 0, 1, 0) != 0) { printf("Error running function: %s\n", lua_tostring(Lua_Handle, -1)); } int Return = (int)lua_tointeger(Lua_Handle, -1); lua_pop(Lua_Handle, 1); Take note though that your script must FIRST be loaded into the vm.
-
-
lua_baselibopen(luaVM); lua_iolibopen(luaVM); lua_strlibopen(luaVM); lua_mathlibopen(luaVM);
-