1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

is_player() is no player-only function

This commit is contained in:
est31 2015-05-12 05:49:14 +02:00
parent 02805af36e
commit b4c3ff6eab
3 changed files with 14 additions and 14 deletions

View file

@ -557,6 +557,16 @@ int ObjectRef::l_set_properties(lua_State *L)
return 0;
}
// is_player(self)
int ObjectRef::l_is_player(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
lua_pushboolean(L, (player != NULL));
return 1;
}
/* LuaEntitySAO-only */
// setvelocity(self, {x=num, y=num, z=num})
@ -705,16 +715,6 @@ int ObjectRef::l_get_luaentity(lua_State *L)
/* Player-only */
// is_player(self)
int ObjectRef::l_is_player(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
lua_pushboolean(L, (player != NULL));
return 1;
}
// is_player_connected(self)
int ObjectRef::l_is_player_connected(lua_State *L)
{