little improvements
This commit is contained in:
@@ -541,6 +541,7 @@ func Install(packagepath string, serial uint) error {
|
|||||||
|
|
||||||
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
|
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
|
||||||
L.SetGlobal("packets_bin_dir", lua.LString(cfg.Config.BinDir))
|
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("execute", lua.LNil)
|
||||||
osObject.RawSetString("exit", lua.LNil)
|
osObject.RawSetString("exit", lua.LNil)
|
||||||
osObject.RawSetString("getenv", lua.LNil)
|
osObject.RawSetString("getenv", lua.LNil)
|
||||||
|
|||||||
@@ -199,10 +199,11 @@ func SafeRemove(L *lua.LState) int {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
L.Push(lua.LFalse)
|
L.Push(lua.LFalse)
|
||||||
L.Push(lua.LString("[packets] remove failed\n" + err.Error()))
|
L.Push(lua.LString("[packets] remove failed\n" + err.Error()))
|
||||||
return 1
|
return 2
|
||||||
}
|
}
|
||||||
L.Push(lua.LTrue)
|
L.Push(lua.LTrue)
|
||||||
return 1
|
L.Push(lua.LNil)
|
||||||
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
func SafeRename(L *lua.LState) int {
|
func SafeRename(L *lua.LState) int {
|
||||||
@@ -334,7 +335,7 @@ func SafeOpen(L *lua.LState) int {
|
|||||||
file, err := os.OpenFile(path, modeFlags(mode), 0644)
|
file, err := os.OpenFile(path, modeFlags(mode), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
L.Push(lua.LNil)
|
L.Push(lua.LNil)
|
||||||
L.Push(lua.LString(err.Error()))
|
L.Push(lua.LString("[packets] open failed\n" + err.Error()))
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user