Counter-Strike 2DGet it now!

Code Command Reference

You can enter CS2D script commands in the console, save them in cfg-files or bind them to keys. CS2D script commands are no Lua commands but they can still be executed in Lua scripts by using the Lua parse-function!

Lua Lua Reference

Lua scripting (server-sided) allows server hosters and mappers to modify the game and to add new elements.

Lua Hooks


Lua Commands


Category: entity (5)


entitylist

Categories

Entity

Parameters

  • [type] (optional)

Info

Returns a list (Lua table) containing the positions (as X and Y tile coordinates) of all entities. You can also limit the output to a certain entity type by using the optional type parameter.

Use a "for"-loop and "in pairs" of Lua to process the resulting list properly!

Sample 1: Iterating over list using in pairs
local list=entitylist()
for _,e in pairs(list) do
   print("entity @ ("..e.x..","..e.y..") - "..entity(e.x,e.y,"typename"))
end

Note: The resulting "list" is actually a Lua table with one sub Lua table per entity in it. The sub tables have the fields/indices "x" and "y" which contain the X and Y tile coordinates of an entity.

Attention: This command worked a bit differently in version b 0.1.2.0 (in which it was introduced). It didn't work properly so a change of the returned table was necessary. Please change your scripts if you used this command in b 0.1.2.0!