G.xpcall
From GMod Wiki
Revision as of 19:07, 11 November 2009 by Crazy Quebecer (Talk | contribs)
Function | |
Syntax |
xpcall( Function func, Function callback ) Where is this used? |
Description: | |
Runs the function and calls callback with an argument of the error message if one occurs. | |
Returns: | nil |
Part of Library: | Global Functions |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=G.xpcall]G.xpcall [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Catch an error |
---|---|
Used on | |
Code | xpcall( function( ) print( 5/ "e" ) end, print ) |
Output | [string "*untitled.lua"]:1: attempt to perform arithmetic on a string value |