From 2f678f862da3ebf5a2529c6ea4e1c9820eb73ac8 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 22 Apr 2014 15:13:37 +0100 Subject: [PATCH] elua: make it possible to return values from constructors --- src/bin/elua/core/util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/elua/core/util.lua b/src/bin/elua/core/util.lua index c58e5e13cc..8824f7e418 100644 --- a/src/bin/elua/core/util.lua +++ b/src/bin/elua/core/util.lua @@ -60,7 +60,7 @@ end M.Object = { __call = function(self, ...) local r = self:clone() - if self.__ctor then self.__ctor(r, ...) end + if self.__ctor then return r, self.__ctor(r, ...) end return r end, @@ -126,7 +126,7 @@ M.Readonly_Object.__call = function(self, ...) rmt.__index = self rmt.__tostring = self.__tostring rmt.__metatable = false - if self.__ctor then self.__ctor(r, rmt, ...) end + if self.__ctor then return r, self.__ctor(r, rmt, ...) end return r end