|
|
@ -9,11 +9,24 @@ using MoonSharp.Interpreter; |
|
|
|
namespace Fungus |
|
|
|
namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Base class for a component which registers Lua Bindings. |
|
|
|
|
|
|
|
/// When FungusScript initialises, it finds all components in the scene that inherit |
|
|
|
|
|
|
|
/// from LuaBindingsBase and calls them to add their bindings. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
public abstract class LuaBindingsBase : MonoBehaviour |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Add all declared bindings to the globals table. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
public abstract void AddBindings(Table globals); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Component which manages a list of bound objects to be accessed in Lua scripts. |
|
|
|
/// Component which manages a list of bound objects to be accessed in Lua scripts. |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
[ExecuteInEditMode] |
|
|
|
[ExecuteInEditMode] |
|
|
|
public class LuaBindings : MonoBehaviour |
|
|
|
public class LuaBindings : LuaBindingsBase |
|
|
|
{ |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Represents a single Unity object (+ optional component) bound to a string key. |
|
|
|
/// Represents a single Unity object (+ optional component) bound to a string key. |
|
|
@ -53,7 +66,7 @@ namespace Fungus |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Add all declared bindings to the globals table. |
|
|
|
/// Add all declared bindings to the globals table. |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public virtual void AddBindings(Table globals) |
|
|
|
public override void AddBindings(Table globals) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Table bindingsTable = null; |
|
|
|
Table bindingsTable = null; |
|
|
|
if (tableName == "") |
|
|
|
if (tableName == "") |
|
|
|