lua-users home
lua-l archive

Re: Capturing Lua variable as a string

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


Oops, one mistake:
configloader2.lua
function load( filename )
 local f = assert( loadfile( filename ) )
 local t = {}
 local old_DEF_PARAM = DEF_PARAM
 local e = setmetatable(
 {
 DEF_PARAM = function( info )
 -- In case DEF_PARAM creates another table...
 info = old_DEF_PARAM( info )
 t[ info ] = true
 return info
 end;
 }, {
 __index = _G;
 __newindex = function( self, k, v )
 if t[ v ] then
 v.NAME = k
 end
 end;
 }
 )
 setfenv( f, e )
 f()
end
~~ end of configloader2.lua
I was also using a 't' as the name of 'self' on '__newindex'. Sorry.
--rb

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