Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        /// <summary>
        /// Converts an IDictionary to a Lua table.
        /// </summary>
        internal static Table ConvertIDictionaryToTable(Script script, IDictionary dict)
        {
            var t = new Table(script);

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

            return(t);
        }