Example #1
0
        private StkId T_GetTMByObj(ref TValue o, TMS tm)
        {
            LuaTable mt = null;

            switch (o.Tt)
            {
            case (int)LuaType.LUA_TTABLE:
            {
                LuaTable tbl = o.HValue();
                mt = tbl.MetaTable;
                break;
            }

            case (int)LuaType.LUA_TUSERDATA:
            {
                LuaUserDataValue ud = o.RawUValue();
                mt = ud.MetaTable;
                break;
            }

            default:
            {
                mt = G.MetaTables[o.Tt];
                break;
            }
            }
            return((mt != null)
                                 ? mt.GetStr(GetTagMethodName(tm))
                                 : TheNilValue);
        }
Example #2
0
		private StkId T_GetTM( LuaTable mt, TMS tm )
		{
			if( mt == null )
				return null;

			var res = mt.GetStr( GetTagMethodName( tm ) );
			if(res.V.TtIsNil()) // no tag method?
			{
				// cache this fact
				mt.NoTagMethodFlags |= 1u << (int)tm;
				return null;
			}
			else
				return res;
		}
Example #3
0
        private StkId T_GetTM(LuaTable mt, TMS tm)
        {
            if (mt == null)
            {
                return(null);
            }

            StkId res = mt.GetStr(GetTagMethodName(tm));

            if (res.V.TtIsNil())            // no tag method?
            {
                // cache this fact
                mt.NoTagMethodFlags |= 1u << (int)tm;
                return(null);
            }
            else
            {
                return(res);
            }
        }