1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add more ways to pass data to check_player_privs

The callback can now be invoked with either the player object or name as
the first parameter, and with either a table or a list of strings, like
this:

    minetest.check_player_privs(player_name, { shout = true, fly = true })
    minetest.check_player_privs(player_name, "shout", "fly")
    minetest.check_player_privs(player, { shout = true, fly = true })
    minetest.check_player_privs(player, "shout", "fly")
This commit is contained in:
Robert Zenz 2015-09-03 21:28:38 +02:00 committed by est31
parent 37c1e20127
commit c32847838d
2 changed files with 29 additions and 7 deletions

View file

@ -1924,8 +1924,11 @@ Call these functions only at load time!
* `minetest.set_player_privs(name, {priv1=true,...})`
* `minetest.get_player_privs(name) -> {priv1=true,...}`
* `minetest.auth_reload()`
* `minetest.check_player_privs(name, {priv1=true,...})`: returns `bool, missing_privs`
* A quickhand for checking privileges
* `minetest.check_player_privs(player_or_name, ...)`: returns `bool, missing_privs`
* A quickhand for checking privileges.
* `player_or_name`: Either a Player object or the name of a player.
* `...` is either a list of strings, e.g. `"priva", "privb"` or
a table, e.g. `{ priva = true, privb = true }`.
* `minetest.get_player_ip(name)`: returns an IP address string
`minetest.set_player_password`, `minetest_set_player_privs`, `minetest_get_player_privs`