From c0c5135762beb102e693d2c58ccc031846f920c7 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, 25 Jan 2019 11:13:38 +0800 Subject: =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/vm.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index b2e8ff7d..b747ccf3 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -3,7 +3,6 @@ local library = require 'core.library' local createValue = require 'core.value' local DefaultSource = { start = 0, finish = 0 } -local GlobalValue local LibraryValue = {} local LibraryChild = {} @@ -1435,17 +1434,20 @@ function mt:doActions(actions) end function mt:getGlobalValue() - if GlobalValue then - return GlobalValue + if self.lsp and self.lsp.globalValue then + return self.lsp.globalValue end - GlobalValue = self:createValue('table') - GlobalValue.GLOBAL = true + local globalValue = self:createValue('table') + globalValue.GLOBAL = true for name, lib in pairs(library.global) do - local field = GlobalValue:createField(name) + local field = globalValue:createField(name) local value = self:getLibValue(lib, 'global') self:setValue(field, value) end - return GlobalValue + if self.lsp then + self.lsp.globalValue = globalValue + end + return globalValue end function mt:createEnvironment() -- cgit v1.2.3