Naming
File header
Every.lua file starts with the license header, then one blank line:
Typing
- Every function has LuaLS annotations:
---@param,---@return. - Namespaces are plain tables with a
---@class. The source is the type source of truth. - To define functions through a local, the local is the class declaration:
- Enums use
---@enumdirectly on the field. - Multiple returns keep one type per slot:
ok, value, errorCode, neverok, valueOrMessage. - Gaps in the CfxLua types go in
types/cfx.lua, never in---@diagnosticcomments.
Errors
- Mutating functions return
ok, valueorok, errorCodewith codes fromUgCore.Enums.Errors. - Programmer errors raise with
UgCore.Internal.Utils.Raise(level, message, ...), nevererror. Messages never include the[ug-core]prefix. - Stack traces never reach clients.
Comments
Short sentences. RFC 2119 keywords for obligations. Comment only where the code needs clarification. Never narrate.Performance
Cache globals and natives in locals only on hot paths: per request, per item or per tick. Everything else calls them directly.Commits
Conventional Commits. Imperative, lowercase subject, no period, 72 characters max.core, players, characters, accounts, jobs, gangs, permissions, identity, sessions, modules, callback, network, events, lifecycle, hooks, database, exports, config, locale, ci, deps.