diff options
Diffstat (limited to 'server/src/vm/vm.lua')
-rw-r--r-- | server/src/vm/vm.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 93b9eb8e..ce4ca020 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -979,16 +979,18 @@ function mt:doFunction(action) source:bindValue(value, 'set') local func = value:getFunction() - if #name == 3 then - -- function x:b() - local loc = self:loadLocal(name[1][1]) - if loc then - func:setObject(parent, loc:getSource()) + if func then + if #name == 3 then + -- function x:b() + local loc = self:loadLocal(name[1][1]) + if loc then + func:setObject(parent, loc:getSource()) + else + func:setObject(parent, name[#name-2]) + end else func:setObject(parent, name[#name-2]) end - else - func:setObject(parent, name[#name-2]) end else local value = self:buildFunction(action) |