gm_luanet - .NET 3.5 for Lua

This is basically a small port I made of LuaInterface.

Basically what LI does, in terms of scripting, allows .NET compliant code to be directly executed in Lua and of which treats Lua as another .NET language (Lua functions can be hooked to functions like Click on a form.)

This is completely open to the .NET interface so any native and non native namespaces may be loaded…

[lua]
require ‘luanet’

luanet.load_assembly(‘mscorlib’) --load_assembly loads a .NET library; the argument may be a dll too
Thread = luanet.import_type(‘System.Threading.Thread’) --Reference an object or namespace

local somevalue

local th = Thread(function ()
print ‘hai’
somevalue = 1 + 1
end)
th:Start()
[/lua]

[lua]
require ‘luanet’

luanet.load_assembly(“System”)
luanet.load_assembly(“System.Windows.Forms”)
Form=luanet.import_type(“System.Windows.Forms.Form”)

frm = Form()
frm:ShowDialog()

[/lua]

For a guide on native namespaces in 3.5: http://msdn.microsoft.com/en-us/library/ms229335.aspx
For a small usage tutorial: http://lua-users.org/wiki/LuaInterface

To install: Place the “LuaInterface.dll” file in your root directory where your “hl2.exe” is placed; put “gm_luanet.dll” in “garrysmod/lua/includes/modules”

Before posting about any problems running this: please be sure you have the .NET framework 3.5 and the visual c++ 2008 runtimes installed.

Download: http://echo.ungamers.com/stuff/gm_luanet.zip
Source: http://echo.ungamers.com/stuff/gm_luanet_src.zip

There are no security filters on this module yet, think about this before deploying. To add a custom .net library drop it into the same place as “LuaInterface.dll”

Cool, I can imagine this being useful on servers in many ways.

edit:

I don’t think that is the best example, though. A single Lua state is not thread safe.

True, I need to add options for a lua state lock or to create a new thread off of the stack.

Will this make my lua make c++heeseburgers too? :3