From c08ce9af7a35be058aafabcb5dd88748aae75282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 25 Sep 2019 16:53:16 +0800 Subject: rawset --- server-beta/src/parser/compile.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'server-beta/src/parser/compile.lua') diff --git a/server-beta/src/parser/compile.lua b/server-beta/src/parser/compile.lua index 457af42c..45fd808b 100644 --- a/server-beta/src/parser/compile.lua +++ b/server-beta/src/parser/compile.lua @@ -3,7 +3,7 @@ local type = type _ENV = nil -local pushError, Root, Compile, CompileBlock, Cache, Block, GoToTag +local pushError, Root, Compile, CompileBlock, Cache, Block, GoToTag, Version, ENVMode local vmMap = { ['nil'] = function (obj) @@ -475,6 +475,15 @@ local vmMap = { Block = obj Root[#Root+1] = obj local id = #Root + if ENVMode == '_ENV' then + Compile({ + type = 'local', + start = 0, + finish = 0, + effect = 0, + [1] = '_ENV', + }, id) + end CompileBlock(obj, id) Block = nil return id @@ -584,6 +593,12 @@ return function (self, lua, mode, version) end pushError = state.pushError Root = state.root + Version = version + if version == 'Lua 5.1' or version == 'LuaJIT' then + ENVMode = 'fenv' + else + ENVMode = '_ENV' + end Cache = {} GoToTag = {} if type(state.ast) == 'table' then -- cgit v1.2.3