OnScriptError: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
28days (talk | contribs)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Info|Event|Client|1.0}}
{{Info|Event|Client & Server|1.0}}


{{FuncDescription|Called when a script error occurs. This is only called when the game was started with the '''-dev''' switch.}}
{{FuncDescription|Called when a script error occurs. On the client side, this is only called when the game was started with the '''-dev''' switch. Available on the sever side since version 1.0.3.}}


{{FuncSyntax|OnScriptError(message)}}
{{FuncSyntax|OnScriptError(message)}}
Line 9: Line 9:


== Example ==
== Example ==
<syntaxhighlight lang="Lua">
function OnScriptError(message)
print(message)
end
AddEvent("OnScriptError", OnScriptError)
</syntaxhighlight>
=== Client-side Example ===
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
function OnScriptError(message)
function OnScriptError(message)
Line 17: Line 25:


{{RelatedFunctions}}
{{RelatedFunctions}}
*[[Template:ClientEvents]]
{{PackageClientEvents}}

Latest revision as of 09:54, 20 January 2020

OnScriptError

Type: Event
Context: Client & Server
Introduced: v1.0

Description

Called when a script error occurs. On the client side, this is only called when the game was started with the -dev switch. Available on the sever side since version 1.0.3.

Syntax

OnScriptError(message)

Parameters

  • message
    The script error message.

Example

function OnScriptError(message)
	print(message)
end
AddEvent("OnScriptError", OnScriptError)

Client-side Example

function OnScriptError(message)
	AddPlayerChat('<span color="#ff0000bb" style="bold" size="10">'..message..'</>')
end
AddEvent("OnScriptError", OnScriptError)

See also