|
I'm writing (yet another) C++ wrapper for Lua
(5.0b) and I'm having serious problems with a function that should be very very
simple :) Here's my code to get a global string:
*****************************************
std::string Cscript::GetString(char
*varName)
{ std::string str; lua_pushstring(lua,
varName);
lua_gettable(lua, LUA_GLOBALSINDEX); str = lua_tostring(lua,lua_gettop(lua)); lua_pop(lua,1); return str;
} *********************************
It works like expected the first time, but then the
second time I call it it crashes on the lua_pushstring line. What am I
doing wrong?
|