Skip to content

Commit

Permalink
Fix: 初始化 Lua 时出错,本次修复应当可以 close #9
Browse files Browse the repository at this point in the history
  • Loading branch information
dzpao committed Jul 8, 2019
1 parent 2802b8e commit c22a709
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down

0 comments on commit c22a709

Please sign in to comment.