Vote count:
0
So I have this problem.
In my program I have a class (LuaScript) which handles lua scripts for me. However I'm running into a bit of a problem when calling lua functions. I have a C++ function called callFunction which works like this:
void LuaScript::callFunction(const std::string& functionName)
{
lua_getglobal(state, "update");
if (lua_pcall(state, 0, 0, 0))
printf("Error calling lua function: %s\n", lua_tostring(state, -1));
}
But it crashes (which I found out after some debugging) on the lua_getglobal bit but it doesn't crash the first time I call the function (which has me believing that the lua_State* somehow is corrupt) and through even more debugging I get this error message from VS:
Unhandled exception at 0x006CBADA (lua5.1.dll)
Access violation reading location 0xDDDDDDED.
FYI, my lua source looks like this:
function update()
print("Hello")
end
I have no idea what do to
asked 27 secs ago
Aucun commentaire:
Enregistrer un commentaire