lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Zé Pedro
Envoyé : 22 janvier 2007 12:40
À : Lua list
Objet : Re: how to remove a value from the globals table

Both the replies have worked fine, thanks. But I suddenly realised that I had another problem. By default variables in Lua are global right? so if the users don't explicitly define their variables as local ones they'll be around for the execution of the next user script. Then I saw that there was a table were the globals are kept in the index LUA_GLOBALSINDEX. Can I made a copy of this table before execute and then after replace it by the copy I made before right? The thing is that I print lua_objlen(pLuaState,LUA_GLOBALSINDEX) (it should print the number of globals or at least a number other than zero right?) and it prints zero. Is this the correct behaviour? Another thing, how can I copy the table to specified index? lua_pushvalue(L, LUA_GLOBALSINDEX) copy it to the top of the stack how can I move it to position COPY_GLOBALSINDEX?

thanks,
José Tavares