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

[CSM] Add function to get player privileges (#5933)

* [CSM] Add function to get player privileges + move related help functions to common

* Added @Zeno- const
This commit is contained in:
red-001 2017-06-07 08:09:06 +01:00 committed by Loïc Blot
parent 6c55874417
commit c91a8c7061
7 changed files with 56 additions and 25 deletions

View file

@ -329,6 +329,16 @@ int ModApiClient::l_take_screenshot(lua_State *L)
return 0;
}
int ModApiClient::l_get_privilege_list(lua_State *L)
{
const Client *client = getClient(L);
lua_newtable(L);
for (const std::string &priv : client->getPrivilegeList()) {
lua_pushboolean(L, true);
lua_setfield(L, -2, priv.c_str());
}
return 1;
}
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
@ -353,4 +363,5 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(get_item_def);
API_FCT(get_node_def);
API_FCT(take_screenshot);
API_FCT(get_privilege_list);
}