Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Quahu/Laylua

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

252 Commits
252 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laylua

Laylua allows you to easily embed Lua 5.4 in your .NET application.

Highlights:

  • plug and play
  • Roslyn source generators and analyzers
  • automatic type marshaling
  • proper handling of exceptions and Lua errors
  • built with sandboxing in mind; limit memory, instructions, and what scripts can access
  • optimized and type-safe, with no value type boxing

Example

using Laylua;
using Laylua.Marshaling;

using var lua = new Lua();

lua.OpenLibrary(LuaLibraries.Standard.Base);

lua["player"] = new Player("Steve");

lua.Execute("""
    player:TakeDamage(25)
    print(player.Name, player.Health)
    """);

[LuaType]
public partial class Player(string name)
{
    public string Name { get; } = name;

    public int Health { get; private set; } = 100;

    public void TakeDamage(int amount)
    {
        Health -= amount;
    }
}

Documentation

Check out the wiki.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.