Add network_is_moderator (#180)
This commit is contained in:
parent
034a4364bf
commit
a864e2d3ba
|
@ -5255,6 +5255,11 @@ function network_global_index_from_local(localIndex)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @return boolean
|
||||
function network_is_moderator()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return boolean
|
||||
function network_is_server()
|
||||
-- ...
|
||||
|
|
|
@ -7228,6 +7228,24 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [network_is_moderator](#network_is_moderator)
|
||||
|
||||
### Lua Example
|
||||
`local booleanValue = network_is_moderator()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
- `boolean`
|
||||
|
||||
### C Prototype
|
||||
`bool network_is_moderator(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [network_is_server](#network_is_server)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -1019,6 +1019,7 @@
|
|||
- network_utils.h
|
||||
- [network_get_player_text_color_string](functions-3.md#network_get_player_text_color_string)
|
||||
- [network_global_index_from_local](functions-3.md#network_global_index_from_local)
|
||||
- [network_is_moderator](functions-3.md#network_is_moderator)
|
||||
- [network_is_server](functions-3.md#network_is_server)
|
||||
- [network_local_index_from_global](functions-3.md#network_local_index_from_global)
|
||||
|
||||
|
|
|
@ -11802,6 +11802,15 @@ int smlua_func_network_global_index_from_local(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_network_is_moderator(UNUSED lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
|
||||
|
||||
|
||||
lua_pushboolean(L, network_is_moderator());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_network_is_server(UNUSED lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
|
||||
|
||||
|
@ -19093,6 +19102,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
// network_utils.h
|
||||
smlua_bind_function(L, "network_get_player_text_color_string", smlua_func_network_get_player_text_color_string);
|
||||
smlua_bind_function(L, "network_global_index_from_local", smlua_func_network_global_index_from_local);
|
||||
smlua_bind_function(L, "network_is_moderator", smlua_func_network_is_moderator);
|
||||
smlua_bind_function(L, "network_is_server", smlua_func_network_is_server);
|
||||
smlua_bind_function(L, "network_local_index_from_global", smlua_func_network_local_index_from_global);
|
||||
|
||||
|
|
|
@ -26,6 +26,11 @@ bool network_is_server(void) {
|
|||
return gNetworkType == NT_SERVER;
|
||||
}
|
||||
|
||||
bool network_is_moderator(void) {
|
||||
extern u8 gIsModerator;
|
||||
return gIsModerator;
|
||||
}
|
||||
|
||||
u8* network_get_player_text_color(u8 localIndex) {
|
||||
if (localIndex >= MAX_PLAYERS) { localIndex = 0; }
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ u8 network_global_index_from_local(u8 localIndex);
|
|||
u8 network_local_index_from_global(u8 globalIndex);
|
||||
|
||||
bool network_is_server(void);
|
||||
bool network_is_moderator(void);
|
||||
|
||||
u8* network_get_player_text_color(u8 localIndex);
|
||||
char* network_get_player_text_color_string(u8 localIndex);
|
||||
|
|
Loading…
Reference in New Issue