Global/CompileString

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Fixed return values, shortened description)
Line 1: Line 1:
{{Function
+
{{Func
| Name = CompileString
+
|Name=CompileString
| Namespace = [[Global]]
+
|Parent=Global
| Realm = Shared
+
|Description=Compiles the string of Lua code as a function and returns it.<br /> If there is an error, it will print the error to the console and return nil.<br/> If HandleError is set to false, it will return an error string on failure, instead of nil.
 +
|Realm=Shared
 +
|IsClass=No
 
}}
 
}}
{{Syntax
+
{{Arg
 
+
|type=string
| Name = CompileString
+
|name=code
| Description = Compiles the string of Lua code as a function and returns it.<br /> If there is an error, it will print the error to the console and return nil.<br/> If HandleError is set to false, it will return an error string on failure, instead of nil.
+
|desc=The code to run.
|Returns = {{Return|function|result}} or {{Return|string|errorMessage}} or nil
+
}}
 
+
{{Arg
| Arg1Name = code
+
|type=string
| Arg1Type = string
+
|name=identifier
| Arg1Req = true
+
|desc=The name to display next to the left side of the line number.
| Arg1Desc = The code to run.
+
}}
 
+
{{Arg
| Arg2Name = identifier
+
|type=boolean
| Arg2Type = string
+
|name=HandleError
| Arg2Req = true
+
|desc=If you(false) or the regular error handler(true) will handle the error.
| Arg2Desc = The name to display next to the left side of the line number.
+
 
+
| Arg3Name = HandleError
+
| Arg3Type = boolean
+
| Arg3Req = false
+
| Arg3Desc = If you(false) or the regular error handler(true) will handle the error.
+
| Arg3Default = true
+
 
}}
 
}}

Revision as of 16:16, 26 February 2013

 CompileString( )

Contents

Description

Compiles the string of Lua code as a function and returns it.
If there is an error, it will print the error to the console and return nil.
If HandleError is set to false, it will return an error string on failure, instead of nil.

Arguments

string code

The code to run.

Arguments

string identifier

The name to display next to the left side of the line number.

Arguments

boolean HandleError

If you(false) or the regular error handler(true) will handle the error.
Personal tools
Navigation