4 Commits
Author SHA1 Message Date
Kipstz 31122abe10 Merge branch 'BeamMP:minor' into refactor-string-optimizations 2025-12-28 00:56:24 +01:00
Kipstz 38de5be365 Merge branch 'BeamMP:minor' into fix-jsonencode-index-zero 2025-12-28 00:56:18 +01:00
Kipstz b74f0c7ca8 refactor: optimize string operations and improve code clarity
- Avoid redundant substr() calls in packet parsing hot-path (TServer.cpp)
  The previous code called substr(3) twice per packet, creating
  unnecessary temporary strings. Now stores the result once.

- Replace .size() == 0 with .empty() for idiomatic C++
  (TConsole.cpp, TLuaEngine.cpp)
2025-12-27 23:46:45 +01:00
Kipstz 14c69893e8 Fix JsonEncode treating tables with index 0 as arrays
Tables with index 0 should be encoded as JSON objects, not arrays.
Lua arrays start at index 1, so any table with keys outside 1-N range
should be treated as an object.

Added IsLuaArray() helper that checks all keys are integers >= 1.

Closes #348
2025-12-24 16:35:54 +01:00