G.assert

From GMod Wiki

Jump to: navigation, search
Function
Syntax assert( Boolean condition, String message )
Where is this used?
Description:
Evaluates the condition, and errors with the string if it returns false.
Returns: String
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.assert]G.assert [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionErrors if file.txt is blank.
Used onNewerShared.png
Code
assert(file.Read("file.txt"), "Oops.")
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox