LuaInterface.LuaDLL.lua_remove C# (CSharp) Method

lua_remove() public static method

public static lua_remove ( IntPtr l, int idx ) : void
l System.IntPtr
idx int
return void
        public static void lua_remove(IntPtr l, int idx)
        {
            lua_rotate(l, (idx), -1);
            lua_pop(l, 1);
        }

Usage Example

示例#1
0
        public static int callConstructor(IntPtr luaState)
        {
            ObjectTranslator objectTranslator = ObjectTranslator.FromState(luaState);
            MethodCache      methodCache      = default(MethodCache);
            object           rawNetObject     = objectTranslator.getRawNetObject(luaState, 1);

            if (rawNetObject == null || !(rawNetObject is IReflect))
            {
                LuaDLL.luaL_error(luaState, "trying to call constructor on an invalid type reference");
                LuaDLL.lua_pushnil(luaState);
                return(1);
            }
            IReflect reflect = (IReflect)rawNetObject;

            LuaDLL.lua_remove(luaState, 1);
            ConstructorInfo[] constructors = reflect.UnderlyingSystemType.GetConstructors();
            ConstructorInfo[] array        = constructors;
            for (int i = 0; i < array.Length; i++)
            {
                ConstructorInfo constructorInfo = array[i];
                bool            flag            = objectTranslator.metaFunctions.matchParameters(luaState, constructorInfo, ref methodCache);
                if (flag)
                {
                    try
                    {
                        objectTranslator.push(luaState, constructorInfo.Invoke(methodCache.args));
                    }
                    catch (TargetInvocationException e)
                    {
                        objectTranslator.metaFunctions.ThrowError(luaState, e);
                        LuaDLL.lua_pushnil(luaState);
                    }
                    catch
                    {
                        LuaDLL.lua_pushnil(luaState);
                    }
                    return(1);
                }
            }
            string arg = (constructors.Length != 0) ? constructors[0].Name : "unknown";

            LuaDLL.luaL_error(luaState, string.Format("{0} does not contain constructor({1}) argument match", reflect.UnderlyingSystemType, arg));
            LuaDLL.lua_pushnil(luaState);
            return(1);
        }
All Usage Examples Of LuaInterface.LuaDLL::lua_remove
LuaDLL