LuaInterface.ObjectTranslator.pushFunction C# (CSharp) Method

pushFunction() private method

private pushFunction ( IntPtr luaState, LuaCSFunction func ) : void
luaState IntPtr
func LuaCSFunction
return void
        internal void pushFunction(IntPtr luaState, LuaCSFunction func)
        {
            pushObject(luaState,func,"luaNet_function");
        }

Usage Example

        public static int getConstructorSignature(IntPtr luaState)
        {
            ObjectTranslator objectTranslator = ObjectTranslator.FromState(luaState);
            IReflect         reflect          = null;
            int num = LuaDLL.luanet_checkudata(luaState, 1, "luaNet_class");

            if (num != -1)
            {
                reflect = (IReflect)objectTranslator.objects[num];
            }
            if (reflect == null)
            {
                objectTranslator.throwError(luaState, "get_constructor_bysig: first arg is invalid type reference");
            }
            Type[] array = new Type[LuaDLL.lua_gettop(luaState) - 1];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = objectTranslator.FindType(LuaDLL.lua_tostring(luaState, i + 2));
            }
            try
            {
                ConstructorInfo constructor = reflect.UnderlyingSystemType.GetConstructor(array);
                objectTranslator.pushFunction(luaState, new LuaCSFunction(new LuaMethodWrapper(objectTranslator, null, reflect, constructor).call));
            }
            catch (Exception ex)
            {
                objectTranslator.throwError(luaState, ex.Message);
                LuaDLL.lua_pushnil(luaState);
            }
            return(1);
        }
All Usage Examples Of LuaInterface.ObjectTranslator::pushFunction