lua __index的简写
标准写法是:
local b = {}
b.__index = {}
function b.__index:func1(name)
...
end
function b.__index:func2(name)
...
end
简写:
local b = {}
b.__index = b
function b:func1(name)
...
end
function b:func2(name)
...
end
标准写法是:
local b = {}
b.__index = {}
function b.__index:func1(name)
...
end
function b.__index:func2(name)
...
end
简写:
local b = {}
b.__index = b
function b:func1(name)
...
end
function b:func2(name)
...
end