[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: struggling Lua globals..
 
- From: Asko Kauppi <asko.kauppi@...>
 
- Date: Thu, 1 Jul 2004 19:17:30 +0300
 
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%