Lua.NET 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Lua.NET --version 1.2.0                
NuGet\Install-Package Lua.NET -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lua.NET" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lua.NET --version 1.2.0                
#r "nuget: Lua.NET, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Lua.NET as a Cake Addin
#addin nuget:?package=Lua.NET&version=1.2.0

// Install Lua.NET as a Cake Tool
#tool nuget:?package=Lua.NET&version=1.2.0                

Lua.NET

C# .NET Core 6.0 Lua bindings and helper functions.

https://github.com/tilkinsc/Lua.NET
Copyright © Cody Tilkins 2022 MIT License

dotnet add package Lua.NET --version 1.2.0

Supports Lua5.4 Lua5.3 Lua5.2 Lua5.1 and LuaJIT

Hardcoded to only use doubles and 64-bit integers, so the Lua library will have to be built accordingly. This CAN be changed with manual edits, but it wasn't fun writing this library. This code was made with with the default includes on a 64-bit windows 10 machine using Lua's makefile and LuaJIT. All DLL's are named differently, make sure the name of the Lua dll matches that of the .cs file; will make it easier in the future.

Lua5.4 - lua544.dll
Lua5.3 - lua536.dll
Lua5.2 - lua524.dll
Lua5.1 - lua515.dll
LuaJIT - lua51.dll

Example Usage Lua5.4.4:

namespace LuaNET;

using static Lua54.Lua;

class Project
{
	
	public static int lfunc(IntPtr L)
	{
		lua_getglobal(L, "print");
		lua_pushstring(L, "lol");
		lua_pcallk(L, 1, 0, 0, IntPtr.Zero, null);
		return 0;
	}
	
	public static void Main(String[] args)
	{
		
		IntPtr L = luaL_newstate();
		if (L == IntPtr.Zero)
		{
			Console.WriteLine("Unable to create context!");
		}
		luaL_openlibs(L);
		lua_pushcfunction(L, lfunc);
		Console.WriteLine(lua_pcallk(L, 0, 0, 0, IntPtr.Zero, null));
		lua_close(L);
		
		Console.WriteLine("Success");
		
	}
	
}

Example Usage LuaJIT:

namespace LuaNET;

using static LuaJIT.Lua;

class Project
{
	
	public static int lfunc(IntPtr L)
	{
		lua_getglobal(L, "print");
		lua_pushstring(L, "lol");
		lua_pcall(L, 1, 0, 0);
		return 0;
	}
	
	public static void Main(String[] args)
	{
		
		IntPtr L = luaL_newstate();
		if (L == IntPtr.Zero)
		{
			Console.WriteLine("Unable to create context!");
		}
		luaL_openlibs(L);
		lua_pushcfunction(L, lfunc);
		Console.WriteLine(lua_pcall(L, 0, 0, 0));
		lua_close(L);
		
		Console.WriteLine("Success");
		
	}
	
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.3 384 4/3/2024
4.1.0 193 1/24/2024
4.0.1 354 7/1/2023
3.0.0 179 6/21/2023
2.1.0 406 12/26/2022
2.0.0 623 6/27/2022
1.3.0 439 6/25/2022
1.2.0 425 6/25/2022
1.1.0 440 6/24/2022
1.0.0 430 6/20/2022