kts.PlaceItem – add an item to the dungeon


success = kts.PlaceItem(position, itemtype)

success = kts.PlaceItem(position, itemtype, number)


This attempts to place an item of type itemtype at dungeon position pos.

If number is specified, then a stack of number items will be placed, otherwise a single item will be placed.

If the given map position contains a chest or barrel tile, then the new item will be placed inside the chest or barrel, otherwise it will be placed directly on the floor.

If the given position already contains an item, then placement will fail.

Return Value

Returns true if item placement succeeds, or false otherwise.


Errors may result if the position is not a valid map position (i.e. a table containing x and y values), or itemtype is not an ItemType value, or number (if present) is not a valid integer.


This is used in the Tutorial to place some initial items at fixed positions within the tutorial map. See tutorial/init.lua.

See Also