Get object||doc136854

September 20, 2022

Format

World:getObject(objID)
  • Function class:World
  • Call limit:Common

Describe

Find object instances in the world by object ID and return object instances.


Matters Needing Attention

The objects sent and accessed by the client are limited, and they can only access objects within the scope of the client's vision. There is no such restriction on the server.


parameter

Variable name Type Describe
objID int Object ID


Return value

Type Describe
Object Object instance


Code example

Get the object instance with object ID 1 in the world

local object = World.CurWorld:getObject(1)
    if object then
        print(object.name)
    end