fix: use load from source in DoFile function instead of load chunk

pull/143/head
TorchedSammy 2022-04-19 21:25:52 -04:00
parent d4084a82ba
commit 7a17d7931f
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 3 additions and 3 deletions

View File

@ -93,9 +93,9 @@ func DoFile(rtm *rt.Runtime, path string) error {
buf = append(buf, line...)
}
chunk, err := rtm.CompileAndLoadLuaChunk(path, buf, rt.TableValue(rtm.GlobalEnv()))
if chunk != nil {
_, err = rt.Call1(rtm.MainThread(), rt.FunctionValue(chunk))
clos, err := rtm.LoadFromSourceOrCode(path, buf, "bt", rt.TableValue(rtm.GlobalEnv()), false)
if clos != nil {
_, err = rt.Call1(rtm.MainThread(), rt.FunctionValue(clos))
}
return err