G.error

From GMod Wiki

Jump to: navigation, search
Function
Syntax error( String message, Number level )
Where is this used?
Description:
Throws a new error with the text message as well as a stack trace. Level is used to determine where the error is reported to. Execution of the file is stopped.
Returns: nil
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.error]G.error [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionError level 1
Used onNewerShared.png
Code
 
function fail(level)
	error("failed",level)
end
--fail(0)	
fail(1)
fail(2)
Outputfail.lua:2: failed
DescriptionError level 2
Used onNewerShared.png
Code
 
function fail(level)
	error("failed",level)
end
--fail(0)	
--fail(1)
fail(2)
Outputfail.lua:6: failed

Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox