From 6b4bc410d622253e48a7901081af9b1cb6747047 Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Wed, 8 Nov 2017 11:19:31 +0000 Subject: [PATCH] Fix return of super.static if val false (fix #50) --- middleclass.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/middleclass.lua b/middleclass.lua index 0d9a834..5f0aeef 100644 --- a/middleclass.lua +++ b/middleclass.lua @@ -79,7 +79,15 @@ local function _createClass(name, super) subclasses = setmetatable({}, {__mode='k'}) } 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 setmetatable(aClass.static, { __index = function(_,k) return rawget(dict,k) end }) end