local function enum(tbl)
if tbl == nil or type(tbl) ~= "table" then
return nil
end
tbl.__index = tbl
tbl.__newindex = function()
print("can not modify enum")
end
return setmetatable({}, tbl)
end
function main()
local mode = enum {
SinglePlayer = 1,
TwoPlayers= 2,
ThreePlayers= 3,
FourPlayers= 4,
PVCom= 5,
}
mode.SinglePlayer = 2
print(mode.SinglePlayer)
end
main()