HelperLib: add getObjectByGUID & immersive craft data methods
This commit is contained in:
16
mods/SYSTEM/HelperLib/src/Lib/getObjectByGUID.lua
Normal file
16
mods/SYSTEM/HelperLib/src/Lib/getObjectByGUID.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
---Returns an active object by unique identifier (GUID).
|
||||
---* For players, this is a player name.
|
||||
---* For Lua entities, this is a uniquely generated string, guaranteed not to collide with player names.
|
||||
---
|
||||
---**Note**: If an object with such an identifier does not exist or is inactive, the value `nil` will be returned.
|
||||
---@param guid string only use printable ASCII characters. Example: `@bGh3p2AbRE29Mb4biqX6OA`.
|
||||
---@return ObjectRef|Player|Entity|nil
|
||||
function Smc.getObjectByGUID(guid)
|
||||
local obj = core.objects_by_guid[guid]
|
||||
|
||||
if obj == nil then
|
||||
return
|
||||
else
|
||||
return obj
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user