31 lines
549 B
Smarty
31 lines
549 B
Smarty
{{
|
|
enums = x.enums
|
|
beans = x.beans
|
|
tables = x.tables
|
|
}}
|
|
local setmetatable = setmetatable
|
|
local pairs = pairs
|
|
local ipairs = ipairs
|
|
local tinsert = table.insert
|
|
|
|
local function SimpleClass()
|
|
local class = {}
|
|
class.__index = class
|
|
class.New = function(...)
|
|
local ctor = class.ctor
|
|
local o = ctor and ctor(...) or {}
|
|
setmetatable(o, class)
|
|
return o
|
|
end
|
|
return class
|
|
end
|
|
|
|
|
|
local function get_map_size(m)
|
|
local n = 0
|
|
for _ in pairs(m) do
|
|
n = n + 1
|
|
end
|
|
return n
|
|
end
|