Example #1
0
 public Object Get(Type type, Int32 stackPos = -1)
 {
     if (Marshals.ContainsKey(type))
     {
         ILuaTypeMarshal marshal = Marshals[type];
         return(Convert.ChangeType(marshal.Get(this, stackPos), type));
     }
     return(null);
 }
Example #2
0
 public void Push(Object obj, Type type)
 {
     if (Marshals.ContainsKey(type))
     {
         ILuaTypeMarshal marshal = Marshals[type] as ILuaTypeMarshal;
         marshal.Push(this, obj);
     }
     else
     {
         ILuaTypeMarshal backupMarshal = Marshals.Where(kv => type.IsCastableTo(kv.Key)).Select(kv => kv.Value).FirstOrDefault();
         if (backupMarshal != null)
         {
             backupMarshal.Push(this, obj);
         }
     }
 }
Example #3
0
 public static void RegisterMarshal(Type t, ILuaTypeMarshal marshal) => Marshals.Add(t, marshal);