little improvements

This commit is contained in:
2025-08-02 10:18:28 -03:00
parent 4fe636e629
commit bf4ec434a9
2 changed files with 5 additions and 3 deletions

View File

@@ -541,6 +541,7 @@ func Install(packagepath string, serial uint) error {
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
L.SetGlobal("packets_bin_dir", lua.LString(cfg.Config.BinDir))
L.SetGlobal("script", lua.LString(manifest.Hooks.Install))
osObject.RawSetString("execute", lua.LNil)
osObject.RawSetString("exit", lua.LNil)
osObject.RawSetString("getenv", lua.LNil)

View File

@@ -199,10 +199,11 @@ func SafeRemove(L *lua.LState) int {
if err != nil {
L.Push(lua.LFalse)
L.Push(lua.LString("[packets] remove failed\n" + err.Error()))
return 1
return 2
}
L.Push(lua.LTrue)
return 1
L.Push(lua.LNil)
return 2
}
func SafeRename(L *lua.LState) int {
@@ -334,7 +335,7 @@ func SafeOpen(L *lua.LState) int {
file, err := os.OpenFile(path, modeFlags(mode), 0644)
if err != nil {
L.Push(lua.LNil)
L.Push(lua.LString(err.Error()))
L.Push(lua.LString("[packets] open failed\n" + err.Error()))
return 2
}