Skip to content

Instantly share code, notes, and snippets.

@viniciusjarina
Created July 15, 2015 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viniciusjarina/b97adde7cb7c0870e52e to your computer and use it in GitHub Desktop.
Save viniciusjarina/b97adde7cb7c0870e52e to your computer and use it in GitHub Desktop.
using System;
using NLua;
namespace EventLua
{
public class MyClass
{
public Action actionFromLua;
}
class MainClass
{
public static void Main (string[] args)
{
var lua = new Lua ();
lua.LoadCLRPackage ();
var myClass = new MyClass ();
myClass.actionFromLua = () => Console.WriteLine ("Triggered from Lua");
lua ["myClass"] = myClass;
lua.DoSt
ring (" myClass.actionFromLua () "); // calling a member action or
lua ["myAction"] = (Action)(() => Console.WriteLine ("Second Action"));
lua.DoString (" myAction () ");
Console.WriteLine ("Hello World!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment