Ulysses

General => Developers Corner => Topic started by: Promptitude on December 18, 2015, 12:43:31 AM

Title: Getting all ULX ranks
Post by: Promptitude on December 18, 2015, 12:43:31 AM
How would I check all ULX ranks inside of a .lua file?
Title: Re: Getting all ULX ranks
Post by: Timmy on December 18, 2015, 01:12:24 AM
All groups (and their permissions) are stored in ULib.ucl.groups.

Code: [Select]
for group in pairs(ULib.ucl.groups) do
    print(group)
end
Title: Re: Getting all ULX ranks
Post by: Promptitude on December 18, 2015, 04:29:34 AM
Is it stored anywhere without permissions so I don't have to take them out?
Title: Re: Getting all ULX ranks
Post by: Timmy on December 18, 2015, 04:53:34 AM
Yes! It looks like the group names are also stored in ulx.group_names.
https://github.com/TeamUlysses/ulx/blob/40274fe877c970a71437c583c9640a718ebb80ba/lua/ulx/modules/sh/user.lua#L24

Code: [Select]
> PrintTable(ulx.group_names)...
1       =       superadmin
2       =       operator
3       =       user
4       =       admin

Edit: But you'd have to make sure your script executes after ulx/lua/ulx/modules/sh/user.lua, which could be annoying.
Title: Re: Getting all ULX ranks
Post by: Promptitude on December 18, 2015, 05:20:27 AM
It executes on command. Just a derma menu.

Also, thanks a heap for the help.
Title: Re: Getting all ULX ranks
Post by: Timmy on December 18, 2015, 05:47:50 AM
Ah, that won't be be an issue then. Glad I could help! :)