lua-users home
lua-l archive

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


>I was wondering if it was possible from standard lua to set the global 
>environment to another table prior to a dofile(), then kill the temp one 
>and restore the main?

Sure. In Lua 4 do

	do 
	 local newG={ fill here with what is needed in the sandbox }
	 local oldG=globals(newG)
	 oldG.dofile(xxx)
	 oldG.globals(oldG)
	end

>Are co-routines possible with Lua 4? I'm a bit hesitant to move to Lua 5... 

Co-routines are *the* reason for moving to Lua 5... (Well, not exactly,
because Lua 5 brings a bunch of other nice stuff, but co-routines were
a major addition to Lua and were introduced in Lua 5).

>and I haven't taken the time to try and compile Lua 5.

Fair enough, but it should be as easy as any other version, perhaps easier
because the core relies less on the standard C library (although this won't
be a problem in Windows).
--lhf