fix the use of empty fields in the response

This commit is contained in:
2025-10-10 22:22:15 +03:00
parent bed0471cc4
commit ee6fd205d5
2 changed files with 3 additions and 6 deletions

View File

@@ -37,7 +37,9 @@ func NewError(code int, message string, data any, id *json.RawMessage) *RPCRespo
Error = map[string]any{
"code": code,
"message": message,
"data": data,
}
if data != nil {
Error["data"] = data
}
return &RPCResponse{

View File

@@ -186,11 +186,6 @@ func (h *HandlerV1) handleLUA(sid string, r *http.Request, req *rpc.RPCRequest,
L.SetField(scriptDataTable, "result", resTable)
L.SetField(outTable, "send", L.NewFunction(func(L *lua.LState) int {
res := L.Get(1)
if res == lua.LNil {
__exit = 0
L.RaiseError("__successfull")
return 0
}
resFTable := scriptDataTable.RawGetString("result")
if resPTable, ok := res.(*lua.LTable); ok {