Coder Social home page Coder Social logo

strogo / neolua Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neolithos/neolua

0.0 2.0 0.0 3.22 MB

A Lua implementation for the Dynamic Language Runtime (DLR).

Home Page: https://neolua.codeplex.com/

License: Apache License 2.0

C# 94.04% Lua 5.00% PowerShell 0.06% Batchfile 0.01% Visual Basic 0.90%

neolua's Introduction

NeoLua

A Lua implementation for the Dynamic Language Runtime (DLR).

Introduction

NeoLua is an implementation of the Lua language. Currently, the implementation is on the level of Lua_5.3 (http://www.lua.org/manual/5.3/manual.html). The goal is to follow the reference of the C-Lua implementation and combine this with full .NET Framework support. That means, it should be easy to call .NET functions from Lua and it should be easy access variables and functions from a .net language (e.g. C#, VB.NET, ...).

NeoLua is implemented in C# and uses the Dynamic Language Runtime. It therefore integrates very well with the .net framework.

Quickstart

You can play and test the language with the tool NeoCmd.

NeoCmd

Or there are two easy ways to use NeoLua in your project.

  • Download the Neo.Lua.dll and add the reference. For full desktop support also a reference to Neo.Lua.Desktop.dll is useful.
  • Install the NuGet-Package of NeoLua.

Simple example:

using (Lua l = new Lua()) // create the lua script engine
{
  dynamic g = l.CreateEnvironment(); // create a environment
  g.dochunk("a = 'Hallo World!';", "test.lua"); // create a variable in lua
  Console.WriteLine(g.a); // access a variable in c#
  g.dochunk("function add(b) return b + 3; end;", "test.lua"); // create a function in lua
  Console.WriteLine("Add(3) = {0}", g.add(3)); // call the function in c#
}

NeoLua is a .net portable assembly (IL) for

  • .net framework 4.5.1
  • Windows Phone 8.1
  • Windows Store Apps 8.1
  • Xamarin.Android
  • Xamarin.iOS.

There will be no support for .net frameworks lower than 4.5.

What NeoLua is useful for

  • Outsource the logic of your application into scripts
  • Structuring of logic
  • Build a dynamic configuration system, with functions and variables
  • As a formula parser
  • ...

So, this could be reliable partner for your compiled .NET application or engine (e.g. Game Engines).

What I did not have in mind

  • Compiling libraries
  • Standalone applications

Advantages of NeoLua

  • Dynamic access between Lua script and and the host application/.NET framework and vice-versa.
  • NeoLua is based on the DLR. So you get compiled code that is collectable and well-optimized.
  • It is compatible with the .NET world (e.g. C#, VB.NET, IronPython, ...).
  • Full and easy access to the .NET framework or your own libraries (with no stub code).
  • A rich implementation of the lua table, for a got integration in the .net world e.g. Binding, Enumeration, ...
  • A .NET Framework Garbage Collector that is well-tested and very fast.
  • Pure IL (x86,x64 support)

Drawbacks of NeoLua

  • It is not 100% compatible to Lua. But I will try very hard.
  • No deployment of precompiled scripts.

Drawbacks of bridges to c-lua, that are solved with NeoLua

  • You have two memory managers and so you have to marshal every data between these two worlds. That takes time and there are a lot pitfalls to get memory leaks.
  • C-Lua interprets its own bytecode. The code is not compiled to machine code.

Documentation

This documention has the same structure like the official reference (Lua 5.3), so it should be easy to compare the two worlds.

  1. Introduction
  2. Basic concepts
  3. Language
  4. Application Program Interface
    1. Getting started
    2. Script engine
    3. Chunks
    4. Table's
  5. The Auxiliary Library
    1. clr library
    2. Extent lua table
    3. Debugging
  6. Standard libraries
  7. NeoCmd

If there is something unclear, wrong or misunderstanding please use the discussions.

Links

neolua's People

Contributors

andrew-boyarshin avatar hdkeeper avatar neolithos avatar orthographic-pedant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.