-
Notifications
You must be signed in to change notification settings - Fork 1
Functions
Kevin Zhao edited this page Jan 25, 2018
·
2 revisions
Functions can be created using either overload of the CreateFunction
method:
var function = lua.CreateFunction(@"
local x = ...
return x * x * x");
var function = lua.CreateFunction(new Func<int, int>(x => x * x * x));
These functions can be called using the Call
method with a variable number of arguments. The results will be returned in an object
array, with an empty object
array indicating the lack of any return values.
LuaFunction
s support dynamic
access:
var function = lua.CreateFunction(new Func<int, int>(x => x * x * x));
Assert.Equal(216L, function(6));