Wax

Memos

Small caches for paths the game runs many times a frame: one per frame, one timed.

The Explorer searches everything on this page, and the classes of the game too.

WaxMemoModule

Small caches for hot paths: a frame memo forgets everything when the frame changes, a timed one forgets an entry after its seconds. A hook the game calls hundreds of times a frame answers the same question from one of these after the first time.

Below, memo stands for one of these.

Open in the Explorer

memo.frame()

A cache that holds its entries for the rest of the current frame.

memo.frame(): WaxMemo

Returns WaxMemo

Open in the Explorer

memo.timed(seconds)

A cache whose entries last this many seconds from when they were set.

memo.timed(seconds: number): WaxTimedMemo
ParameterType
secondsnumber

Returns WaxTimedMemo

Open in the Explorer

WaxMemo

You get one from memo.frame. Below, memo stands for one of these.

Open in the Explorer

PropertyTypeDescription
countintegerHow many entries it holds.
hitsintegerHow many times get or take answered from an entry.

memo:get(key)

The value kept under the key, or nil. Keys are any Lua value; false is kept as a value.

memo:get(key: any): any
ParameterType
keyany

Returns any

Open in the Explorer

memo:has(key)

True when an entry is there.

memo:has(key: any): boolean
ParameterType
keyany

Returns boolean

Open in the Explorer

memo:set(key, value)

Keeps a value under the key and answers it.

memo:set(key: any, value: any): any
ParameterType
keyany
valueany

Returns any

Open in the Explorer

memo:take(key, fn, ...)

The value kept under the key, or fn(...) kept under it now. A nil answer is not kept.

memo:take(key: any, fn: fun(...): any, ...: any): any
ParameterType
keyany
fnfun(...): any
...any

Returns any

Open in the Explorer

memo:clear()

Forgets every entry.

memo:clear()

Returns nothing.

Open in the Explorer

WaxTimedMemo

It can also do everything WaxMemo can. You get one from memo.timed. Below, timedMemo stands for one of these.

Open in the Explorer

timedMemo:sweep()

Drops every entry whose seconds are over.

timedMemo:sweep()

Returns nothing.

Open in the Explorer

On this page