lua-users home
lua-l archive

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


You need to use a "proxy" table:

tt = {'a', 'b', 'cc'}
old_tt = tt
tt = {}
mt = {
  __newindex = function(table, key, value) error("Attempt to modify
read-only table") end,
 __index = old_tt
}
setmetatable(tt, mt)

-- 
Geoffroy Carrier