-
Notifications
You must be signed in to change notification settings - Fork 13
Home
#Getting started with NetLua
NetLua is still in its earlies form, but it is usable to a broad extent.
It currently implements most basic functions specified in the Lua 5.2 manual.
The Lua 5.2 syntax is almost wholly implemented (with the only exception being goto statements).
Metatables are fully supported.
Currently, there are no support functions apart from basic and math functions, so functions like print, read or os.* must be implemented by the user. As can be seen from the README, it is pretty simple though.
Using NetLua only requires a compiled binary of NetLua.
Once the library has been added to the project, all of its features can be accessed from the NetLua namespace.
The NetLua.Lua class can be used for quick execution of Lua code. It automatically sets the basic functions like setmetatable, type and error.
// using NetLua;
Lua lua = new Lua();
lua.DoString(@"a={x=3, y=4}
mt={}
mt.__add = function(a,b)
return {x=a.x + b.x, y=a.y + b.y}
end
setmetatable(a, mt)
b = a + {x=1, y=5}");
var b = lua.Context.Get("b");LuaObject inherits the DynamicObject class and can be used as a standard dynamic object.
dynamic a = lua.DynamicContext.a;
a.field = 5;
var x = a.x;