Skip to content

Commit

Permalink
Add minetest.set_player_privs strictness
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu committed Sep 5, 2023
1 parent 2976e29 commit 5f0a93b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions minetest.lua
Expand Up @@ -206,6 +206,19 @@ deprecated(ItemStackMT, "stack:", {
set_metadata = "get_meta()",
})

local set_player_privs = minetest.set_player_privs
function minetest.set_player_privs(name, privs)
assert(type(privs) == "table", "privs should be a table")
for _, v in pairs(privs) do
if v == false then
action"`false` value in `privs`, this is almost certainly a bug granting a privilege rather than revoking it"
elseif v ~= true then
action"non-`true` value in `privs` set" -- code smell
end
end
return set_player_privs(name, privs)
end

--[[
TODO: implement the following deprecations:
- Tile def `image` field (replaced by `name`)
Expand Down

0 comments on commit 5f0a93b

Please sign in to comment.