float lua_getglobalvar(lua_State* L, char* s)
{
lua_pushstring(L, s);
lua_gettable(L, LUA_GLOBALSINDEX);
float f = lua_tonumber(L, 2);
lua_pop(L, 1);
return f;
}
void lua_setglobalvar(lua_State* L, char* s, float value)
{
lua_pushstring(L, s);
lua_pushnumber(L, value);
lua_settable(L, LUA_GLOBALSINDEX);
}
void lua_rmglobalvar(lua_State* L, char* s)
{
lua_pushstring(L, s);
lua_pushnil(L);
lua_settable(L, LUA_GLOBALSINDEX);
}
I just can not figure out how to change the gobal variables on other environments and switch between them.
Thanks for the help!
Dwiel
Find out about my diy LCD projector and programming projects!