From 1596b8d8c35f3b73b92da65c6cdadba1db1d0299 Mon Sep 17 00:00:00 2001 From: Some1else{} <60107965+Some1Lambda@users.noreply.github.com> Date: Sun, 28 Apr 2024 23:10:04 +0200 Subject: [PATCH] Add Entity:getNetworkVars() (#1714) * Added Entity:getNetworkVars() * Sanitized and error-proofed * Added "table?" --- lua/starfall/libs_sh/entities.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/starfall/libs_sh/entities.lua b/lua/starfall/libs_sh/entities.lua index cb8216ef7..a741364dc 100644 --- a/lua/starfall/libs_sh/entities.lua +++ b/lua/starfall/libs_sh/entities.lua @@ -1895,4 +1895,13 @@ function ents_methods:mapCreationID() return getent(self):MapCreationID() end +--- Returns entity's networked variables table (data table). +-- @shared +-- @return table? The networked variables table of the entity or nil if it doesn't have one. +function ents_methods:getNetworkVars() + local ent = getent(self) + return istable(ent.dt) and instance.Sanitize(ent:GetNetworkVars()) or nil +end + + end