mirror of https://github.com/Hilbis/Hilbish
fix: dont use luar to pass command args to commander
parent
006f0f986e
commit
c95fb05fbf
7
shell.go
7
shell.go
|
@ -55,11 +55,16 @@ func RunInput(input string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if commands[cmdArgs[0]] != nil {
|
if commands[cmdArgs[0]] != nil {
|
||||||
|
luacmdArgs := l.NewTable()
|
||||||
|
for _, str := range cmdArgs[1:] {
|
||||||
|
luacmdArgs.Append(lua.LString(str))
|
||||||
|
}
|
||||||
|
|
||||||
err := l.CallByParam(lua.P{
|
err := l.CallByParam(lua.P{
|
||||||
Fn: commands[cmdArgs[0]],
|
Fn: commands[cmdArgs[0]],
|
||||||
NRet: 1,
|
NRet: 1,
|
||||||
Protect: true,
|
Protect: true,
|
||||||
}, luar.New(l, cmdArgs[1:]))
|
}, luacmdArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr,
|
fmt.Fprintln(os.Stderr,
|
||||||
"Error in command:\n\n" + err.Error())
|
"Error in command:\n\n" + err.Error())
|
||||||
|
|
Loading…
Reference in New Issue