Fix return of super.static if val false (fix #50)

This commit is contained in:
Qais Patankar 2017-11-08 11:19:31 +00:00 committed by GitHub
parent 27a64f107e
commit 6b4bc410d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,15 @@ local function _createClass(name, super)
subclasses = setmetatable({}, {__mode='k'}) } subclasses = setmetatable({}, {__mode='k'}) }
if super then if super then
setmetatable(aClass.static, { __index = function(_,k) return rawget(dict,k) or super.static[k] end }) setmetatable(aClass.static, {
__index = function(_,k)
local result = rawget(dict,k)
if result == nil {
return super.static[k]
}
return result
end
})
else else
setmetatable(aClass.static, { __index = function(_,k) return rawget(dict,k) end }) setmetatable(aClass.static, { __index = function(_,k) return rawget(dict,k) end })
end end