elua: make it possible to return values from constructors

This commit is contained in:
Daniel Kolesa 2014-04-22 15:13:37 +01:00 committed by Daniel Kolesa
parent c68a73d6e2
commit 2f678f862d
1 changed files with 2 additions and 2 deletions

View File

@ -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