Hilbish/runnermode.go

48 lines
775 B
Go
Raw Normal View History

package main
/*
import (
)
func runnerModeLoader(L *lua.LState) *lua.LTable {
exports := map[string]lua.LGFunction{
"sh": shRunner,
"lua": luaRunner,
"setMode": hlrunnerMode,
}
mod := L.SetFuncs(L.NewTable(), exports)
L.SetField(mod, "mode", runnerMode)
return mod
}
func shRunner(L *lua.LState) int {
cmd := L.CheckString(1)
exitCode, err := handleSh(cmd)
var luaErr lua.LValue = lua.LNil
if err != nil {
luaErr = lua.LString(err.Error())
}
L.Push(lua.LNumber(exitCode))
L.Push(luaErr)
return 2
}
func luaRunner(L *lua.LState) int {
cmd := L.CheckString(1)
exitCode, err := handleLua(cmd)
var luaErr lua.LValue = lua.LNil
if err != nil {
luaErr = lua.LString(err.Error())
}
L.Push(lua.LNumber(exitCode))
L.Push(luaErr)
return 2
}
*/