G.PCallError

From GMod Wiki

Revision as of 16:46, 24 July 2011 by TheFreeman193 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax PCallError( Function Func [, Var Args, ...] )
Where is this used?
Description:
Utility function, returns false and automatically reports an error if there is one.
Returns: Boolean , Var , ...
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.PCallError]G.PCallError [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThe function, as found in lua\includes\util.lua.
Used onNewerShared.png
Code
function PCallError( ... )
 
	local errored, retval = pcall( unpack( arg ) )
 
	if ( !errored ) then
		ErrorNoHalt( retval )
		return false, retval
	end
 
	return true, retval
 
end
OutputBoolean , Var


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox