aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_clientobject.cpp9
-rw-r--r--src/script/lua_api/l_clientobject.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/script/lua_api/l_clientobject.cpp b/src/script/lua_api/l_clientobject.cpp
index 90f0bcd15..d88b538a1 100644
--- a/src/script/lua_api/l_clientobject.cpp
+++ b/src/script/lua_api/l_clientobject.cpp
@@ -87,6 +87,14 @@ int ClientObjectRef::l_is_player(lua_State *L)
return 1;
}
+int ClientObjectRef::l_is_local_player(lua_State *L)
+{
+ ClientObjectRef *ref = checkobject(L, 1);
+ GenericCAO *gcao = get_generic_cao(ref, L);
+ lua_pushboolean(L, gcao->isLocalPlayer());
+ return 1;
+}
+
int ClientObjectRef::l_get_name(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
@@ -210,6 +218,7 @@ luaL_Reg ClientObjectRef::methods[] = {luamethod(ClientObjectRef, get_pos),
luamethod(ClientObjectRef, get_acceleration),
luamethod(ClientObjectRef, get_rotation),
luamethod(ClientObjectRef, is_player),
+ luamethod(ClientObjectRef, is_local_player),
luamethod(ClientObjectRef, get_name),
luamethod(ClientObjectRef, get_attach),
luamethod(ClientObjectRef, get_nametag),
diff --git a/src/script/lua_api/l_clientobject.h b/src/script/lua_api/l_clientobject.h
index 88a6956bc..521591444 100644
--- a/src/script/lua_api/l_clientobject.h
+++ b/src/script/lua_api/l_clientobject.h
@@ -60,6 +60,9 @@ private:
// is_player(self)
static int l_is_player(lua_State *L);
+
+ // is_local_player(self)
+ static int l_is_local_player(lua_State *L);
// get_name(self)
static int l_get_name(lua_State *L);