Garry's Mod Wiki

Revision Difference

Global.error(lowercase)#564558

<ambig page="Global.Error">You might be looking for the "Error" function, which has the same name as this function.</ambig> <function name="error" parent="Global" type="libraryfunc"> <description> Throws a Lua error and breaks out of the current call stack. </description> <realm>Shared and Menu</realm> <args> <arg name="message" type="string">The error message to throw</arg> <arg name="errorLevel" type="number" default="1">The level to throw the error at.</arg> </args> </function></function>⤶ ⤶ <example>⤶ <description>Calling an error that doesn't actually exist.</description>⤶ <code>error("Because I wanted!")</code>⤶ <output>⤶ ```⤶ [my_addon] addons/my_addon/lua/autorun/my_code.lua:1: Because I wanted!⤶ 1. error - [C]:-1⤶ 2. unknown - addons/my_addon/lua/autorun/my_code.lua:1⤶ ```⤶ </output>⤶ </example>