public static UnWrapObject ( object wrapped, NLua.Lua state, string name = null ) : object | ||
wrapped | object | |
state | NLua.Lua | |
name | string | |
Résultat | object |
public override bool TryConvert(ConvertBinder binder, out object result) { result = null; if (binder.Type == typeof(object[])) { result = array; return(true); } if (array.Length != 1) { return(false); } if (array[0].GetType() == typeof(LuaTable) || array[0].GetType() == typeof(LuaFunction)) { result = LuaHelper.UnWrapObject(array[0], state); return(true); } if (array[0].GetType() != binder.Type) { return(false); } result = Convert.ChangeType(array[0], binder.Type); return(true); }
private object GetTableValue(string name) { LuaFunction func = GetMetaFunction("index"); if (func != null) //metatable and metamethod set { return(LuaHelper.UnWrapObject(func.Call(table, name)[0], state, path + "." + name)); } else { return(LuaHelper.UnWrapObject(table[name], state, path + "." + name)); } }
public override bool TryGetMember(GetMemberBinder binder, out object result) { int index; result = null; if (!int.TryParse(binder.Name, out index)) { return(false); } if (index >= array.Length) { return(false); } result = LuaHelper.UnWrapObject(array[index], state); return(true); }
public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result) { int index; result = null; if (!int.TryParse(indexes[0].ToString(), out index)) { return(false); } if (index >= array.Length) { return(false); } result = LuaHelper.UnWrapObject(array[index], state); return(true); }
private object GetTableValue(string name) { object val = table[name]; if (val != null) { return(LuaHelper.UnWrapObject(val, state, path + "." + name)); } //not found, check __index of metatable LuaFunction func = GetMetaFunction("index"); if (func != null) //metatable and metamethod set { return(LuaHelper.UnWrapObject(func.Call(table, name)[0], state, path + "." + name)); } else { return(null); } }
public dynamic GetMetatable() { return(LuaHelper.UnWrapObject(state.DoString(String.Format("return getmetatable({0})", path), "DynamicLua internal operation")[0], state)); }
private object GetLuaValue(string name) { return(LuaHelper.UnWrapObject(lua[name], lua, name)); }