mirror of
https://github.com/Hilbis/Hilbish
synced 2025-07-03 17:52:02 +00:00
lots of commented out code ive found a go lua library which implements lua 5.4 and found an opportunity to start working on it. this commit basically removes everything and just leaves enough for the shell to be "usable" and able to start. there are no builtins or libraries (besides the `hilbish` global)
48 lines
775 B
Go
48 lines
775 B
Go
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
|
|
}
|
|
*/
|