Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Command Lua Commands

Category: object (4)

Lua Command closeobjects

Categories

Parameters

  • x
  • y
  • radius
  • [type] (optional)

Info

Returns a list of objects which are within the specified radius (in pixels) around the specified position (X|Y) in pixels. Use type to limit the search to objects with a certain type only.

Object types are:
CS2D Dynamic Objects
Sample 1: Get the IDs of objects which are close (300 pixel radius) around the top left corner (0|0) of the map:
local objectlist=closeobjects(0,0,300)
for _,id in pairs(objectlist) do
   print(id)
end

Note: The position (X|Y) and the radius are specified in PIXELS!