From 301a843ca3300027493b39d36f707c452a1469cd Mon Sep 17 00:00:00 2001 From: steve donovan Date: Sun, 2 Oct 2011 19:05:52 +0200 Subject: rawget needed for base ctor lookup when handler defined --- lua/pl/class.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/pl/class.lua b/lua/pl/class.lua index 773623e..5cfbf99 100644 --- a/lua/pl/class.lua +++ b/lua/pl/class.lua @@ -2,12 +2,7 @@ -- Two possible notations:
B = class(A) or class.B(A) .
--

The latter form creates a named class.

-- See the Guide for further discussion --- @class module --- @name pl.class - ---[[ -module ('pl.class') -]] +-- @module pl.class local error, getmetatable, io, pairs, rawget, rawset, setmetatable, tostring, type = _G.error, _G.getmetatable, _G.io, _G.pairs, _G.rawget, _G.rawset, _G.setmetatable, _G.tostring, _G.type @@ -15,7 +10,8 @@ local error, getmetatable, io, pairs, rawget, rawset, setmetatable, tostring, ty -- the resulting recursive call problems. local function call_ctor (c,obj,...) -- nice alias for the base class ctor - if rawget(c,'_base') then obj.super = c._base._init end + local base = rawget(c,'_base') + if base then obj.super = rawget(base,'_init') end local res = c._init(obj,...) obj.super = nil return res -- cgit v1.2.3