Refactor error handling and utility functions; remove deprecated code and improve logging

This commit is contained in:
alex
2025-07-05 16:05:03 +03:00
parent b70819e976
commit 2fdc32ce9f
13 changed files with 132 additions and 162 deletions

View File

@@ -0,0 +1,26 @@
package utils
import lua "github.com/yuin/gopher-lua"
func ConvertLuaTypesToGolang(value lua.LValue) any {
switch value.Type() {
case lua.LTString:
return value.String()
case lua.LTNumber:
return float64(value.(lua.LNumber))
case lua.LTBool:
return bool(value.(lua.LBool))
case lua.LTTable:
result := make(map[string]interface{})
if tbl, ok := value.(*lua.LTable); ok {
tbl.ForEach(func(key lua.LValue, value lua.LValue) {
result[key.String()] = ConvertLuaTypesToGolang(value)
})
}
return result
case lua.LTNil:
return nil
default:
return value.String()
}
}