Introduce a new logging level for lua values

This commit is contained in:
2025-03-27 20:06:50 +01:00
parent da93770334
commit d236811cb9
2 changed files with 32 additions and 3 deletions

View File

@@ -424,12 +424,21 @@ func BuildLuaScript(luaExpr string) string {
func printToGo(L *lua.LState) int {
top := L.GetTop()
args := make([]interface{}, top)
for i := 1; i <= top; i++ {
args[i-1] = L.Get(i)
}
message := fmt.Sprint(args...)
logger.Info("[Lua] %s", message)
// Format the message with proper spacing between arguments
var parts []string
for _, arg := range args {
parts = append(parts, fmt.Sprintf("%v", arg))
}
message := strings.Join(parts, " ")
// Use the LUA log level with a script tag
logger.Lua("%s", message)
return 0
}