예제 #1
0
int CLuaACLDefs::aclGroupListACL ( lua_State* luaVM )
{
//  table aclGroupListACL ( aclgroup theGroup )
    CAccessControlListGroup* pGroup;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pGroup );
    
    if ( !argStream.HasErrors () )
    {
        // Create a table to return into
        lua_newtable ( luaVM );

        // Loop through ACL stuff
        unsigned int uiIndex = 0;
        list <CAccessControlList* > ::const_iterator iter = pGroup->IterBeginACL ();
        for ( ; iter != pGroup->IterEndACL (); ++iter )
        {
            // Push onto the table
            lua_pushnumber ( luaVM, ++uiIndex );
            lua_pushacl ( luaVM, *iter );
            lua_settable ( luaVM, -3 );
        }
        // Return the table
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    // Return true
    lua_pushboolean ( luaVM, false );
    return 1;
}
예제 #2
0
int CLuaACLDefs::aclGroupListACL ( lua_State* luaVM )
{
    // Verify the arguents
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
        // Grab and verify the group
        CAccessControlListGroup* pGroup = lua_toaclgroup ( luaVM, 1 );
        if ( pGroup )
        {
            // Create a table to return into
            lua_newtable ( luaVM );

            // Loop through ACL stuff
            unsigned int uiIndex = 0;
            list <CAccessControlList* > ::const_iterator iter = pGroup->IterBeginACL ();
            for ( ; iter != pGroup->IterEndACL (); iter++ )
            {
                // Push onto the table
                lua_pushnumber ( luaVM, ++uiIndex );
                lua_pushacl ( luaVM, *iter );
                lua_settable ( luaVM, -3 );
            }

            // Return the table
            return 1;
        }
    }

    // Return true
    lua_pushboolean ( luaVM, false );
    return 1;
}