lua-users home
lua-l archive

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


Russ Webb wrote:
On the Lua side, something like
return dostring('return config.' .. key)
would work but not be very efficient (does that matter?).

Speed is not that important, no.

The problem with dostring() is it can't reference 'self', or any local. I could work around it by setting self to some mangled global, getting the value, and then clearing the global but that's kind of ugly.

	function Registry:getValue(key)
	   _REGISTRY_SELF = self
	   local value = dostring("return _REGISTRY_SELF." .. key)
	   _REGISTRY_SELF = nil
	   return value
	end

It is possible that there could be more than one registry object at a time, and when Lua coroutines get mixed in there too, it could get ugly.

Jason