GM:OnClientLuaError
Recently Added
This was recently added in version (2025.05.16). It might only be available on the Dev Branch right now.
Description
Called on the server when a Lua error occurs on a client and is sent to the server.
This hook allows server-side code to detect and log client-side errors.
See GM:OnLuaError for a hook that captures Lua errors directly within its realm.
Note that the stack argument can contain a table with 0 values.
Warning: the hook "protects" against lua error spam. If it has 5 errors in less than 1 second, the hook will not receive any of these 4 errors.
Arguments
1 string error
The error that occurred. As well as the path and line of the error. Example : addons/test/lua/autorun/client/test_error.lua:4: 'then' expected near '<eof>'
Example
Example of a hook to retrieve clients errors
Output: -- The “error” function is used to generate
tStack:
[1]:
["File"] = [C]
["Function"] = error
["Line"] = -1
[2]:
["File"] = addons/test/lua/autorun/client/test_error.lua
["Function"] =
["Line"] = 3
The player Vitroze_Gaming has encountered an error in addon 'test' : addons/test/lua/autorun/client/test_error.lua:3: This is a test for the hook. Generated by the error function
-- A syntax error is generated
tStack: (No Value)
The player Vitroze_Gaming has encountered an error in addon 'test' : addons/test/lua/autorun/client/test_error.lua:4: 'then' expected near '<eof>'