You will need to drop the attached file somewhere in your project, and then make this small modification to LuaInterpreter/Lua.cs:
Code: Select all
public object asObject
{
get
{
if (hasReturnValue)
{
return ((Language.Lua.LuaUserdata)luaValue).Value;
}
return null;
}
}
public bool isObject { get { return hasReturnValue && luaValue is Language.Lua.LuaUserdata; } }
Code: Select all
DialogueLua.SetTableField("Item", "itemName", "object", new Language.Lua.LuaUserdata(myObject, Language.Lua.LuaBinding.GetMetaTable()));
Code: Select all
print[lua(Item["itemName"].object.propertyName)])
or
Code: Select all
lua(Item["itemName"].object.MethodName())]
Code: Select all
Lua.Result res = DialogueLua.GetVariable(itemVarName);
if (res.isObject)
{
item = res.luaValue.Value as MyItem;
}
Anyway I hope this is interesting to someone out there, any feedback or suggestions just let me know.