ShopItem

Group
shop
Methods
10
Fields
None

Getting one

shop:item(…)

Methods

MethodReturnsDescription
id()numberThe item's id.
stock()numberHow many the shop has.
slot()numberWhich shop slot it sits in.
name()string?The item's name.
actions(){ string }Every menu option this shop slot exposes.
buyOptions(){ number }Which buy quantities this row actually offers, in menu order.
buy1()booleanBuy one.
buy5()booleanBuy five.
buy10()booleanBuy ten.
buy50()booleanBuy fifty. The game truncates to available stock, so this buys twelve when twelve are stocked.

Returned by

MethodReturnsDescription
Shop.itemShopItem?The row stocking an item, resolved live.
Shop.items{ ShopItem }Everything the shop has in stock; empty when it is shut.

Method details

name

name: (ShopItem) -> string?

The item's name.

Returns
nil when the id has no definition.

actions

actions: (ShopItem) -> { string }

Every menu option this shop slot exposes.

buyOptions

buyOptions: (ShopItem) -> { number }

Which buy quantities this row actually offers, in menu order.

Usually {1, 5, 10, 50}, but not always -- some shops have no Buy 50. Read this rather than assuming the full four.

buy50

buy50: (ShopItem) -> boolean

Buy fifty. The game truncates to available stock, so this buys twelve when twelve are stocked.