fix: dont use luar to pass command args to commander

pull/78/head
sammyette 2021-10-17 17:46:26 -04:00
parent 006f0f986e
commit c95fb05fbf
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 6 additions and 1 deletions

View File

@ -55,11 +55,16 @@ func RunInput(input string) {
return
}
if commands[cmdArgs[0]] != nil {
luacmdArgs := l.NewTable()
for _, str := range cmdArgs[1:] {
luacmdArgs.Append(lua.LString(str))
}
err := l.CallByParam(lua.P{
Fn: commands[cmdArgs[0]],
NRet: 1,
Protect: true,
}, luar.New(l, cmdArgs[1:]))
}, luacmdArgs)
if err != nil {
fmt.Fprintln(os.Stderr,
"Error in command:\n\n" + err.Error())