Exemple #1
0
        public static int Iterator(IntPtr ptr)
        {
            object o = CheckObj(ptr, 1);

            if (o is IEnumerable)
            {
                IEnumerable e    = o as IEnumerable;
                IEnumerator iter = e.GetEnumerator();
                LuaObject.PushValue(ptr, true);
                LuaObject.PushLightObject(ptr, iter);
                LuaNativeMethods.lua_pushcclosure(ptr, _iter, 1);
                return(2);
            }

            return(Error(ptr, "passed in object isn't enumerable"));
        }
Exemple #2
0
 public static void PushCSFunction(IntPtr ptr, LuaCSFunction function)
 {
     LuaNativeMethods.lua_getref(ptr, Get(ptr).callCSFunctionRef);
     LuaNativeMethods.lua_pushcclosure(ptr, function, 0);
     LuaNativeMethods.lua_call(ptr, 1, 1);
 }