I'm currently writing a game that uses lua as a scripting language for characters. While trying to do something I noticed that it isn't setting to values inside structs.
For my base actor class I have a System.Numerics.Vector3 and when I try to get it it works. For example this would work
using System.Numerics;
using NLua;
internal class Actor
{
public Vector3 position = Vector3.Zero;
public Lua luaState = new Lua();
public Actor()
{
luaState.DoString(@"
function PrintPos(actor)
print(actor.position.X)
end
");
luaState.GetFunction("PrintPos").Call(this);
//prints 0.0
}
}
but for whatever reason this wouldn't work
using System.Numerics;
using NLua;
internal class Actor
{
public Vector3 position = Vector3.Zero;
public Lua luaState = new Lua();
public Actor()
{
luaState.DoString(@"
function PrintPos(actor)
print(actor.position.X)
end
");
luaState.DoString(@"
function SetPos(actor)
actor.position.X = 2.5
end
");
luaState.GetFunction("PrintPos").Call(this);
//prints 0.0
luaState.GetFunction("SetPos").Call(this);
luaState.GetFunction("PrintPos").Call(this);
//prints 0.0
}
}
Im pretty sure this might be a bug of some sort, either that or im doing something wrong, which if I am could i get some help?
I'm currently writing a game that uses lua as a scripting language for characters. While trying to do something I noticed that it isn't setting to values inside structs.
For my base actor class I have a
System.Numerics.Vector3
and when I try to get it it works. For example this would workbut for whatever reason this wouldn't work
Im pretty sure this might be a bug of some sort, either that or im doing something wrong, which if I am could i get some help?