Original Post
Hey guys, I did a search, and couldn''t find on google or here how to create multipule environments and switch between them. I have seen people say that this is what they do, but I can''t find any examples... just links to the references. I have looked through the references and still can''t seem to get it to work.
If someone could post some simple code that would create 2 new environments, and call a function from C switching between the two that would be really cool. I don''t think the code for that would be that long...
I have been able to access global variables by doing:
My home page!!!
Find out about my diy LCD projector and programming projects!
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!