lua-users home
lua-l archive

struggling Lua globals..

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


I'm trying to merge setfenv() sandboxing and LuaX module loading, but getting confused.. Doesn't even a regular 'for' loop work under a restricted environment: (I think it should, it's sort of a language feature, not a function, right..?)
	setfenv( 0, {
 print= assert(print),
 error= assert(error),
 assert= assert(assert),
 pairs= assert(pairs),
	} )
	for k,v in pairs{'a','b'} do print(k,v) end
Running:
	lua: tmp.lua:9: attempt to call a nil value
	stack traceback:
 tmp.lua:9: in main chunk
 [C]: ?
	[iMac:~/TestBox/Sources/luax-perforce] asko%

AltStyle によって変換されたページ (->オリジナル) /