CompileString
Description
This function will compile the code argument as lua code and return a function that will execute that code.
Please note that this function will not automatically execute the given code after compiling it.
Arguments
2 string identifier
An identifier in case an error is thrown. (The same identifier can be used multiple times)
3 boolean handleError = true
If false this function will return an error string instead of throwing an error.
Returns
1 function
A function that, when called, will execute the given code.
Returns the error string if there was a Lua error and third argument is false.
Example
Code that will not compile, with ErrorHandling set to false.
Output: TestCode:1: unfinished string near '<eof>' (this is not a script error - it is a returned string)
Example
Code that will compile.
Output: Hi
Example
Compiled code with custom arguments; captured with the varargs identifier.
Output: 1 2 3 A B C
5
AB
1 2