Get all objects||doc136855

September 20, 2022


  • Function class:World
  • Call limit:Common


Return a table containing all object instances in the game world, with player ID as the key and player instance as the value.

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.

Return value

Type Describe
table Table containing all object instances

Code example

Get all objects in the current world and output their object IDs and names

    local objects = World.CurWorld:getAllObject()
    for _, object in pairs(objects) do