LuaInterface.LuaFunction.Push C# (CSharp) Method

Push() public method

public Push ( Array array ) : void
array Array
return void
        public void Push(Array array)
        {
            luaState.Push(array);
            ++argCount;
        }

Same methods

LuaFunction::Push ( Bounds bounds ) : void
LuaFunction::Push ( Color clr ) : void
LuaFunction::Push ( Enum e ) : void
LuaFunction::Push ( IntPtr ptr ) : void
LuaFunction::Push ( LuaBaseRef lbr ) : void
LuaFunction::Push ( LuaByteBuffer buffer ) : void
LuaFunction::Push ( Quaternion quat ) : void
LuaFunction::Push ( Ray ray ) : void
LuaFunction::Push ( RaycastHit hit ) : void
LuaFunction::Push ( Touch t ) : void
LuaFunction::Push ( Type t ) : void
LuaFunction::Push ( UnityEngine o ) : void
LuaFunction::Push ( Vector2 v2 ) : void
LuaFunction::Push ( Vector3 v3 ) : void
LuaFunction::Push ( Vector4 v4 ) : void
LuaFunction::Push ( bool b ) : void
LuaFunction::Push ( double num ) : void
LuaFunction::Push ( int n ) : void
LuaFunction::Push ( long num ) : void
LuaFunction::Push ( object o ) : void
LuaFunction::Push ( string str ) : void
LuaFunction::Push ( uint un ) : void
LuaFunction::Push ( ulong un ) : void

Usage Example

    void Start()
    {
        lua = new LuaState();
        lua.Start();
        lua.DoString(script, "AccessingArray.cs");

        int[] array = { 1, 2, 3, 4, 5};
        func = lua.GetFunction("TestArray");

        func.BeginPCall();
        func.Push(array);
        func.PCall();
        double arg1 = func.CheckNumber();
        string arg2 = func.CheckString();
        bool arg3 = func.CheckBoolean();
        Debugger.Log("return is {0} {1} {2}", arg1, arg2, arg3);
        func.EndPCall();

        //转换一下类型,避免可变参数拆成多个参数传递
        object[] objs = func.Call((object)array);

        if (objs != null)
        {
            Debugger.Log("return is {0} {1} {2}", objs[0], objs[1], objs[2]);
        }

        lua.CheckTop();
    }
All Usage Examples Of LuaInterface.LuaFunction::Push