I'm getting the item fine, but not getting the tiles for the area I've selected. I've tried pairs and ipairs.
am I doing the tiles = event.tiles wrong? Thanks for any help.
Code: Select all
script.on_event(defines.events.on_player_selected_area, function(event)
local player = game.players[event.player_index]
local tiles = event.tiles
local item = event.item
player.print("item name " .. item)
if item == "place-item" then
for _,tile in ipairs(tiles) do
player.print("tile name " .. tile.name)
end
end
end)
on_player_selected_area
Called after a player selects an area with a selection-tool item.
Contains
player_index :: uint: The player doing the selection.
area :: BoundingBox: The area selected.
item :: string: The item used to select the area.
entities :: array of LuaEntity: The entities selected.
tiles :: array of LuaTile: The tiles selected.
LuaTile
class LuaTile - sort
collides_with(layer) What type of things can collide with this tile?
name :: string [R] Prototype name of this tile.
prototype :: LuaTilePrototype [R]
position :: Position [R] The position this tile references.
hidden_tile :: string (optional) [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
A single "square" on the map.