lua-users home
lua-l archive

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


Hi everyone. I have a little issue with the __index metamethod. It seems to me I'm doing something really stupid, but I can't see where.
 
do
 
mt = {}
mt.__index = function(t, k) print("prueba2 --" .. k) end
 
ipStartData = {}
setmetatable(ipStartData, mt)
 
ipStartData.version = 256 -- 0x0100
ipStartData.delimiter = ","
ipStartData.num_boards = 1
ipStartData.board_list = ipBoardInfo
 
end
 
The __index method does not get called when I access the table. But __newindex does. Have I misunderstood the concept of __index?
What I'd like to achieve eventually is something like proxy tables (I need to set the members of C structs).
I'm using Lua 5.0.
 
Thanks in advance,
Ignacio Burgueño