This project is read-only.

This Project Has Moved

This mirror is no longer being maintained.  For the newest code and updates, please see our GitHub page:

https://github.com/TheModMaker/ModMaker.Lua

Project Description

ModMaker.Lua is a complete rebuild of Lua for use in .NET. The code has been entirely written in C# with no unmanaged code. This library parses Lua code, creates a dynamic IL assembly, and executes it in a custom runtime. This library also supports object-oriented Lua by allowing the creation of new types from within Lua code. It is designed to be simple and easy to use while providing extensibility.

Features

  • Simple design.
  • Creation of types in Lua.
    • Derive from .NET Types.
    • Implement .NET Interfaces.
    • Implicit interface implementation.
    • Function overloading.
    • Public fields/properties.
  • Auto registering functions and types.
    • No need to manage the Lua stack.
    • Accepts any method signature.
    • Return multiple values to Lua.
    • Access static and instance members of .NET types.
    • Allows params arrays and optional arguments.
    • Allows by-reference arguments passed to Lua.
  • Dynamic binding.

How To Use This Library

Example:

using ModMaker.Lua;
using ModMaker.Lua.Extensions;

public static string Something(LuaTable table, string arg)
{
     return table[arg];
}
public static void Main(string[] args)
{
     Lua lua = new Lua();

     // register a method for use in  Lua
     lua.Register(Something);

     // load and run a given Lua file
     lua.DoFile("printf.lua", "arguments", 12);

     // get a global variable with name 'Var'
     dynamic E = lua.Environment;
     int d = E.Var;
}

Last edited Jan 12 at 5:52 AM by ModMaker, version 12