PixelCrushers.DialogueSystem.Lua Class Referencesealed

A static class that provides a global Lua virtual machine. More...

Classes

struct  Result
 Stores a Lua interpreter result (LuaValue) and provides easy conversion to basic types. More...
 

Static Public Member Functions

static Result Run (string luaCode, bool debug, bool allowExceptions)
 Runs the specified luaCode.
 
static Result Run (string luaCode, bool debug)
 Runs the specified luaCode.
 
static Result Run (string luaCode)
 Run the specified luaCode.
 
static bool IsTrue (string luaCondition, bool debug, bool allowExceptions)
 Evaluates a boolean condition defined in Lua code.
 
static bool IsTrue (string luaCondition, bool debug)
 Evaluates a boolean condition defined in Lua code.
 
static bool IsTrue (string luaCondition)
 Evaluates a boolean condition defined in Lua code.
 
static bool IsOnlyComment (string luaCode)
 
static Language.Lua.LuaValue RunRaw (string luaCode, bool debug, bool allowExceptions)
 Runs Lua code and returns an array of return values.
 
static Language.Lua.LuaValue RunRaw (string luaCode, bool debug)
 Runs Lua code and returns an array of return values.
 
static Language.Lua.LuaValue RunRaw (string luaCode)
 Runs Lua code and returns an array of return values.
 
static void RegisterFunction (string functionName, object target, MethodInfo method)
 Registers a C# function with the Lua interpreter so it can be used in Lua.
 
static void UnregisterFunction (string functionName)
 Unregisters a C# function.
 

Properties

static Result noResult [get]
 
static Result NoResult [get]
 
static bool wasInvoked [get, set]
 Lua.RunRaw sets this Boolean flag whenever it's invoked.
 
static bool muteExceptions [get, set]
 Set true to not log exceptions to the Console.
 
static bool warnRegisteringExistingFunction [get, set]
 Set true to log warnings if trying to register a function under a name that's already registered.
 
static Language.Lua.LuaTable environment [get]
 Provides direct access to the Lua Interpreter environment.
 
static Language.Lua.LuaTable Environment [get]
 

Detailed Description

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.

Member Function Documentation

◆ IsOnlyComment()

static bool PixelCrushers.DialogueSystem.Lua.IsOnlyComment ( string  luaCode)
inlinestatic

◆ IsTrue() [1/3]

static bool PixelCrushers.DialogueSystem.Lua.IsTrue ( string  luaCondition)
inlinestatic

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
luaConditionThe conditional expression to evaluate. Do not include "return" in front.

◆ IsTrue() [2/3]

static bool PixelCrushers.DialogueSystem.Lua.IsTrue ( string  luaCondition,
bool  debug 
)
inlinestatic

Evaluates a boolean condition defined in Lua code.

Exceptions are ignored.

Returns
true if luaCode evaluates to true; otherwise, false
Parameters
luaConditionThe conditional expression to evaluate. Do not include "return" in front.
debugIf true, logs the Lua command to the console.

◆ IsTrue() [3/3]

static bool PixelCrushers.DialogueSystem.Lua.IsTrue ( string  luaCondition,
bool  debug,
bool  allowExceptions 
)
inlinestatic

Evaluates a boolean condition defined in Lua code.

Returns
true if luaCode evaluates to true; otherwise, false.
Parameters
luaConditionThe conditional expression to evaluate. Do not include "return" in front.
debugIf true, logs the Lua command to the console.
allowExceptionsIf 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 
)
inlinestatic

Registers a C# function with the Lua interpreter so it can be used in Lua.

Parameters
pathThe name of the function in Lua.
targetTarget object containing the registered method. Can be null if a static method.
functionThe method that will be called from Lua.

◆ Run() [1/3]

static Result PixelCrushers.DialogueSystem.Lua.Run ( string  luaCode)
inlinestatic

Run the specified luaCode.

The code is not logged to the console, and exceptions are ignored.

Parameters
luaCodeThe 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 
)
inlinestatic

Runs the specified luaCode.

Exceptions are ignored.

Parameters
luaCodeThe Lua code to run. Generally, if you want a return value, this string should start with "return".
debugIf 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 
)
inlinestatic

Runs the specified luaCode.

Returns
A Result struct from which you can retrieve basic data types from the first return value.
Parameters
luaCodeThe Lua code to run. Generally, if you want a return value, this string should start with "return".
debugIf true, logs the Lua command to the console.
allowExceptionsIf true, exceptions are passed up to the caller. Otherwise they're caught and ignored.

float myHeight = Lua.Run("return height").asFloat;

◆ RunRaw() [1/3]

static Language.Lua.LuaValue PixelCrushers.DialogueSystem.Lua.RunRaw ( string  luaCode)
inlinestatic

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
luaCodeThe Lua code to run. If you want a return value, this string should usually start with "<c>return</c>".

◆ RunRaw() [2/3]

static Language.Lua.LuaValue PixelCrushers.DialogueSystem.Lua.RunRaw ( string  luaCode,
bool  debug 
)
inlinestatic

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
luaCodeThe Lua code to run. If you want a return value, this string should usually start with "<c>return</c>".
debugIf 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 
)
inlinestatic

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
luaCodeThe Lua code to run. If you want a return value, this string should usually start with "<c>return</c>".
debugIf true, logs the Lua command to the console.
allowExceptionsIf 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)
inlinestatic

Unregisters a C# function.

Parameters
functionNameFunction name.

Property Documentation

◆ environment

Language.Lua.LuaTable PixelCrushers.DialogueSystem.Lua.environment
staticget

Provides direct access to the Lua Interpreter environment.

The Interpreter environment.

◆ Environment

Language.Lua.LuaTable PixelCrushers.DialogueSystem.Lua.Environment
staticget

◆ muteExceptions

bool PixelCrushers.DialogueSystem.Lua.muteExceptions
staticgetset

Set true to not log exceptions to the Console.

true if mute exceptions; otherwise, false.

◆ noResult

Result PixelCrushers.DialogueSystem.Lua.noResult
staticget

◆ NoResult

Result PixelCrushers.DialogueSystem.Lua.NoResult
staticget

◆ 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

Lua.RunRaw sets this Boolean flag whenever it's invoked.

true when Lua.RunRaw is invoked.


The documentation for this class was generated from the following file: