From 832c408c4f574c1e3ea9457d3d4e376f63040924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 27 Sep 2019 10:59:21 +0800 Subject: fixed #93 --- server/src/vm/vm.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'server/src/vm') 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) -- cgit v1.2.3