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