is_player() is no player-only function
authorest31 <MTest31@outlook.com>
Tue, 12 May 2015 03:49:14 +0000 (05:49 +0200)
committerest31 <MTest31@outlook.com>
Tue, 12 May 2015 03:52:49 +0000 (05:52 +0200)
doc/lua_api.txt
src/script/lua_api/l_object.cpp
src/script/lua_api/l_object.h

index 93387ef0bd1c4662b4b7bf71a5fb2fc301ed9b9b..8fda137ae89abc9c6506355f5a56ee9bb56eb231 100644 (file)
@@ -2387,6 +2387,7 @@ This is basically a reference to a C++ `ServerActiveObject`
     * `position`: `{x=num, y=num, z=num}` (relative)
     * `rotation`: `{x=num, y=num, z=num}`
 * `set_properties(object property table)`
+* `is_player()`: returns true for players, false otherwise
 
 ##### LuaEntitySAO-only (no-op for other objects)
 * `setvelocity({x=num, y=num, z=num})`
@@ -2404,7 +2405,6 @@ This is basically a reference to a C++ `ServerActiveObject`
 * `get_luaentity()`
 
 ##### Player-only (no-op for other objects)
-* `is_player()`: true for players, false for others
 * `get_player_name()`: returns `""` if is not a player
 * `get_look_dir()`: get camera direction as a unit vector
 * `get_look_pitch()`: pitch in radians
index d8cfaf82b2fdea8f808f3ce18a0d2fcf05eaa464..d913019b1811cc2f4aaebb0f945c02766cc5d1ab 100644 (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)
 {
index d51ca379f47c2707d75e891ad2acd858579247ea..daf91ce56c02621ae6d57bcf097a2b1a9c456649 100644 (file)
@@ -120,6 +120,9 @@ private:
        // set_properties(self, properties)
        static int l_set_properties(lua_State *L);
 
+       // is_player(self)
+       static int l_is_player(lua_State *L);
+
        /* LuaEntitySAO-only */
 
        // setvelocity(self, {x=num, y=num, z=num})
@@ -156,9 +159,6 @@ private:
 
        /* Player-only */
 
-       // is_player(self)
-       static int l_is_player(lua_State *L);
-
        // is_player_connected(self)
        static int l_is_player_connected(lua_State *L);