--定义一个常量
local const = {}
local temp = {}
local mt =
{ --创建一个元表
__newindex = function(t,k,v)
if not temp[k] then
temp[k] = v
else
error("尝试给 const."..k.." 赋值")
end
end,
__index = temp
}
setmetatable(const, mt)
const.test1 = "test1=="
const.test2 = "test2=="