lua-users home
lua-l archive

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


>But still...can I get around the newindex problem to be able to assign
>values to my C vars more than once?If not all else is useless.

One way is to use a proxy table that is always empty and set __index/__newindex
metamethods to read/write from your table or C. Something like this:

C={}	-- proxy for C vars

setmetatable{C,{
	__index = function (t,i) get and return C var i end
	__newindex = function (t,i,v) set C var i to v end
})

The same idea works for implementing the old gettable/settable tag methods.
--lhf