Beispiel #1
0
        /// <summary>
        /// Converts an IList to a Lua table.
        /// </summary>
        internal static Table ConvertIListToTable(Script script, System.Collections.IList list)
        {
            Table t = new Table(script);

            for (int i = 0; i < list.Count; i++)
            {
                t[i + 1] = ClrToScriptConversions.ObjectToDynValue(script, list[i]);
            }
            return(t);
        }
Beispiel #2
0
        /// <summary>
        /// Converts an IDictionary to a Lua table.
        /// </summary>
        internal static Table ConvertIDictionaryToTable(Script script, System.Collections.IDictionary dict)
        {
            Table t = new Table(script);

            foreach (System.Collections.DictionaryEntry kvp in dict)
            {
                DynValue key = ClrToScriptConversions.ObjectToDynValue(script, kvp.Key);
                DynValue val = ClrToScriptConversions.ObjectToDynValue(script, kvp.Value);
                t.Set(key, val);
            }

            return(t);
        }