G.xpcall
From GMod Wiki
| 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 |