Exemplo n.º 1
0
        /// <summary>
        /// Remove and return the last entry in table.
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public static object remove(NativeLuaTable t)
        {
            var value = t[t.__Count()];

            t[t.__Count()] = null;
            return(value);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Insert value into the table at position pos
 /// </summary>
 /// <param name="t"></param>
 /// <param name="pos">1 based position.</param>
 /// <param name="value"></param>
 public static void insert(NativeLuaTable t, int pos, object value)
 {
     for (var i = t.__Count(); i >= pos; i--)
     {
         t[i + 1] = t[i];
     }
     t[pos] = value;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Return the size of the table when seen as a list
        /// </summary>
        /// <param name="t">A native lua table</param>
        /// <returns></returns>
        public static int getn(NativeLuaTable t)
        {
            if (t == null)
            {
                throw new ArgumentNullException(nameof(t));
            }

            return(t.__Count());
        }
Exemplo n.º 4
0
        public static void Foreach(NativeLuaTable t, Action <object, object> iterator)
        {
            if (t == null)
            {
                throw new ArgumentNullException(nameof(t));
            }

            if (iterator == null)
            {
                throw new ArgumentNullException(nameof(iterator));
            }

            t.__Foreach(iterator);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Remove and return the table element at position pos
        /// </summary>
        /// <param name="t"></param>
        /// <param name="pos">1 based position</param>
        /// <returns></returns>
        public static object remove(NativeLuaTable t, int pos)
        {
            var value = t[pos];

            t[pos] = null;

            for (var i = pos + 1; i <= t.__Count(); i++)
            {
                t[i - 1] = t[i];
                t[i]     = null;
            }

            return(value);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Return a list of substrings separated by occurrences of the delimiter.
        /// </summary>
        /// <param name="delimiter"></param>
        /// <param name="str"></param>
        /// <returns></returns>
        public static NativeLuaTable strsplittotable(string delimiter, string str)
        {
            var elements = str.Split(delimiter.ToCharArray());
            var t        = new NativeLuaTable();

            var i = 1;

            foreach (var element in elements)
            {
                t[i] = element;
                i++;
            }
            return(t);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Insert value into the table at end of table.
 /// </summary>
 /// <param name="t"></param>
 /// <param name="value"></param>
 public static void insert(NativeLuaTable t, object value)
 {
     t[t.__Count() + 1] = value;
 }
Exemplo n.º 8
0
 /// <summary>
 /// returns true if value is contained within table.
 /// </summary>
 /// <param name="t"></param>
 /// <param name="obj"></param>
 /// <returns></returns>
 public static bool contains(NativeLuaTable t, object obj)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Sort the elements in the table in-place, optionally using a custom comparator.
 /// </summary>
 /// <param name="t"></param>
 /// <param name="comparer"></param>
 public static void sort(NativeLuaTable t, Action <object, object> comparer)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 /// <summary>
 /// Sort the elements in the table in-place.
 /// </summary>
 /// <param name="t"></param>
 public static void sort(NativeLuaTable t)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 11
0
 /// <summary>
 /// Execute function for each element in table, indices are visited in sequential order. (deprecated, used ipairs instead)
 /// </summary>
 /// <param name="t"></param>
 /// <param name="iterator"></param>
 public static void foreachi(NativeLuaTable t, Action <object, object> iterator)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 12
0
 /// <summary>
 /// Join table of strings into a single string, separated by delimiter.
 /// </summary>
 /// <param name="delimiter"></param>
 /// <param name="t"></param>
 /// <returns></returns>
 public static string strjoinfromtable(string delimiter, NativeLuaTable t)
 {
     throw new NotImplementedException();
 }