示例#1
0
    static int ComponentParam(RealStatePtr L)
    {
        string parameterName;
        string componmentName;

        try
        {
            int paramCount = LuaAPI.lua_gettop(L);
            parameterName  = LuaAPI.lua_tostring(L, 2);
            componmentName = LuaAPI.lua_tostring(L, 3);
        }
        catch (Exception e)
        {
            return(LuaAPI.luaL_error(L, "c# exception:" + e));
        }

        bool hasComponent = contents.ComponetProperty(parameterName, componmentName);

        if (recordedBehaviour)
        {
            callRecords.Add(() =>
            {
                contents.ComponetProperty(parameterName, componmentName);
            });
        }
        try
        {
            if (hasComponent)
            {
                LuaAPI.lua_pushboolean(L, true);
            }
            else
            {
                LuaAPI.lua_pushboolean(L, false);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaAPI.luaL_error(L, "c# exception:" + e));
        }
    }