// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using MoonSharp.Interpreter;
namespace Fungus
{
///
/// Wrapper for a MoonSharp Lua Script instance.
///
public interface ILuaEnvironment
{
///
/// Initialise the Lua interpreter so we can start running Lua code.
///
void InitEnvironment();
///
/// The MoonSharp interpreter instance used to run Lua code.
///
Script Interpreter { get; }
///
/// Loads and compiles a string containing Lua script, returning a closure (Lua function) which can be executed later.
/// The Lua code to be run.
/// A descriptive name to be used in error reports.
///
Closure LoadLuaFunction(string luaString, string friendlyName);
///
/// Load and run a previously compiled Lua script. May be run as a coroutine.
/// A previously compiled Lua function.
/// Run the Lua code as a coroutine to support asynchronous operations.
/// Method to callback when the Lua code finishes exection. Supports return parameters.
///
void RunLuaFunction(Closure fn, bool runAsCoroutine, System.Action onComplete = null);
///
/// Load and run a string containing Lua script. May be run as a coroutine.
/// The Lua code to be run.
/// A descriptive name to be used in error reports.
/// Run the Lua code as a coroutine to support asynchronous operations.
/// Method to callback when the Lua code finishes exection. Supports return parameters.
///
void DoLuaString(string luaString, string friendlyName, bool runAsCoroutine, System.Action onComplete = null);
}
}