A static class that provides a global Lua virtual machine.
More...
|
struct | Result |
| Stores a Lua interpreter result (LuaValue) and provides easy conversion to basic types. More...
|
|
|
static Result | Run (string luaCode, bool debug, bool allowExceptions) |
| Runs the specified luaCode. More...
|
|
static Result | Run (string luaCode, bool debug) |
| Runs the specified luaCode. More...
|
|
static Result | Run (string luaCode) |
| Run the specified luaCode. More...
|
|
static bool | IsTrue (string luaCondition, bool debug, bool allowExceptions) |
| Evaluates a boolean condition defined in Lua code. More...
|
|
static bool | IsTrue (string luaCondition, bool debug) |
| Evaluates a boolean condition defined in Lua code. More...
|
|
static bool | IsTrue (string luaCondition) |
| Evaluates a boolean condition defined in Lua code. More...
|
|
static Language.Lua.LuaValue | RunRaw (string luaCode, bool debug, bool allowExceptions) |
| Runs Lua code and returns an array of return values. More...
|
|
static Language.Lua.LuaValue | RunRaw (string luaCode, bool debug) |
| Runs Lua code and returns an array of return values. More...
|
|
static Language.Lua.LuaValue | RunRaw (string luaCode) |
| Runs Lua code and returns an array of return values. More...
|
|
static void | RegisterFunction (string functionName, object target, MethodInfo method) |
| Registers a C# function with the Lua interpreter so it can be used in Lua. More...
|
|
static void | UnregisterFunction (string functionName) |
| Unregisters a C# function. More...
|
|
A static class that provides a global Lua virtual machine.
This class provides a layer of abstraction between the low level Lua implementation (in this case LuaInterpreter) and the Dialogue System.
◆ IsTrue() [1/3]
static bool PixelCrushers.DialogueSystem.Lua.IsTrue |
( |
string |
luaCondition | ) |
|
|
static |
Evaluates a boolean condition defined in Lua code.
The code is not logged to the console, and exceptions are ignored.
- Returns
true
if luaCode evaluates to true; otherwise, false
- Parameters
-
luaCondition | The conditional expression to evaluate. Do not include "return" in front. |
◆ IsTrue() [2/3]
static bool PixelCrushers.DialogueSystem.Lua.IsTrue |
( |
string |
luaCondition, |
|
|
bool |
debug |
|
) |
| |
|
static |
Evaluates a boolean condition defined in Lua code.
Exceptions are ignored.
- Returns
true
if luaCode evaluates to true; otherwise, false
- Parameters
-
luaCondition | The conditional expression to evaluate. Do not include "return" in front. |
debug | If true , logs the Lua command to the console. |
◆ IsTrue() [3/3]
static bool PixelCrushers.DialogueSystem.Lua.IsTrue |
( |
string |
luaCondition, |
|
|
bool |
debug, |
|
|
bool |
allowExceptions |
|
) |
| |
|
static |
Evaluates a boolean condition defined in Lua code.
- Returns
true
if luaCode evaluates to true; otherwise, false
.
- Parameters
-
luaCondition | The conditional expression to evaluate. Do not include "return" in front. |
debug | If true , logs the Lua command to the console. |
allowExceptions | If true , exceptions are passed up to the caller. Otherwise they're caught and ignored. |
if (Lua.IsTrue("height > 6")) { ... }
◆ RegisterFunction()
static void PixelCrushers.DialogueSystem.Lua.RegisterFunction |
( |
string |
functionName, |
|
|
object |
target, |
|
|
MethodInfo |
method |
|
) |
| |
|
static |
Registers a C# function with the Lua interpreter so it can be used in Lua.
- Parameters
-
path | The name of the function in Lua. |
target | Target object containing the registered method. Can be null if a static method. |
function | The method that will be called from Lua. |
◆ Run() [1/3]
static Result PixelCrushers.DialogueSystem.Lua.Run |
( |
string |
luaCode | ) |
|
|
static |
Run the specified luaCode.
The code is not logged to the console, and exceptions are ignored.
- Parameters
-
luaCode | The Lua code to run. Generally, if you want a return value, this string should start with "return". |
◆ Run() [2/3]
static Result PixelCrushers.DialogueSystem.Lua.Run |
( |
string |
luaCode, |
|
|
bool |
debug |
|
) |
| |
|
static |
Runs the specified luaCode.
Exceptions are ignored.
- Parameters
-
luaCode | The Lua code to run. Generally, if you want a return value, this string should start with "return". |
debug | If set to true , logs the Lua command to the console. |
◆ Run() [3/3]
static Result PixelCrushers.DialogueSystem.Lua.Run |
( |
string |
luaCode, |
|
|
bool |
debug, |
|
|
bool |
allowExceptions |
|
) |
| |
|
static |
Runs the specified luaCode.
- Returns
- A Result struct from which you can retrieve basic data types from the first return value.
- Parameters
-
luaCode | The Lua code to run. Generally, if you want a return value, this string should start with "return". |
debug | If true , logs the Lua command to the console. |
allowExceptions | If true , exceptions are passed up to the caller. Otherwise they're caught and ignored. |
float myHeight = Lua.Run("return height").asFloat;
◆ RunRaw() [1/3]
Runs Lua code and returns an array of return values.
Does not log to console and ignores exceptions.
- Returns
- An array of return values, or
null
if the code generates an error.
- Parameters
-
luaCode | The Lua code to run. If you want a return value, this string should usually start with "<c>return</c>". |
◆ RunRaw() [2/3]
Runs Lua code and returns an array of return values.
Ignores exceptions.
- Returns
- An array of return values, or
null
if the code generates an error.
- Parameters
-
luaCode | The Lua code to run. If you want a return value, this string should usually start with "<c>return</c>". |
debug | If true , logs the Lua command to the console. |
◆ RunRaw() [3/3]
static Language.Lua.LuaValue PixelCrushers.DialogueSystem.Lua.RunRaw |
( |
string |
luaCode, |
|
|
bool |
debug, |
|
|
bool |
allowExceptions |
|
) |
| |
|
static |
Runs Lua code and returns an array of return values.
- Returns
- An array of return values, or
null
if the code generates an error.
- Parameters
-
luaCode | The Lua code to run. If you want a return value, this string should usually start with "<c>return</c>". |
debug | If true , logs the Lua command to the console. |
allowExceptions | If true , exceptions are passed up to the caller. Otherwise they're caught and logged but ignored. |
◆ UnregisterFunction()
static void PixelCrushers.DialogueSystem.Lua.UnregisterFunction |
( |
string |
functionName | ) |
|
|
static |
Unregisters a C# function.
- Parameters
-
functionName | Function name. |
◆ NoResult
readonly Result PixelCrushers.DialogueSystem.Lua.NoResult = new Result(null) |
|
static |
◆ Environment
Provides direct access to the Lua Interpreter environment.
The Interpreter environment.
◆ MuteExceptions
bool PixelCrushers.DialogueSystem.Lua.MuteExceptions |
|
staticgetset |
Set true to not log exceptions to the Console.
true
if mute exceptions; otherwise, false
.
◆ WarnRegisteringExistingFunction
bool PixelCrushers.DialogueSystem.Lua.WarnRegisteringExistingFunction |
|
staticgetset |
Set true to log warnings if trying to register a function under a name that's already registered.
◆ WasInvoked
bool PixelCrushers.DialogueSystem.Lua.WasInvoked |
|
staticgetset |
The documentation for this class was generated from the following file:
- D:/Documents/Unity Projects/Dialogue System/Dev/Source/Assets/Dialogue System/Scripts/Core/Lua/Lua.cs