From c22a709d504621fd01460c464cabb353ba4eefc0 Mon Sep 17 00:00:00 2001 From: dzp Date: Mon, 8 Jul 2019 23:42:08 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E5=88=9D=E5=A7=8B=E5=8C=96=20Lua=20?= =?UTF-8?q?=E6=97=B6=E5=87=BA=E9=94=99=EF=BC=8C=E6=9C=AC=E6=AC=A1=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=BA=94=E5=BD=93=E5=8F=AF=E4=BB=A5=20close=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 70914d7..c9a6705 100644 --- a/main.go +++ b/main.go @@ -76,6 +76,8 @@ func (l *LuaRobot) Reload() { l.Logf("初始化 Lua 环境...") + os.Setenv(lua.LuaPath, "lua/?.lua;;") + luaRobot.lstate = lua.NewState() luaRobot.lstate.SetGlobal("RegEx", luaRobot.lstate.NewFunction(luaRobot.RegEx)) @@ -94,7 +96,6 @@ func (l *LuaRobot) Reload() { return } - os.Setenv(lua.LuaPath, "lua/?.lua;;") if err := luaRobot.lstate.DoFile("lua/main.lua"); err != nil { luaRobot.Panic(err) return