Error

From Garry's Mod
Jump to: navigation, search
 Error( )

Contents

Description

Throws a Lua error with the specified message and stack level.

BUG

Using this function in the menu state exits the menu.

Issue Tracker: #1810

BUG

This function is currently bugged and does not halt execution. It is recommended to use error in the meantime.

Issue Tracker: #2036

Arguments

vararg arguments

Converts all arguments to strings and prints them with no spacing or line breaks.

Examples

Example

An example of the use of this function

local num = 11
if num<=10 and num>=0 then
 print( "The number is", num )
else
 Error( "Number out of range!\n" )
 print("This line will not be run, as it is after the error")
end

Output:

[@lua/example.lua:5] Number out of range!
Personal tools
Navigation