WoW:USERAPI Memorizing table: Difference between revisions

m
Typo fixed to a more precise definition
(New page: {{userfunc}} __NOTOC__ A '''memorizing table''' is a normal table with a metatable designed to find missing values and save them. The mechanics are transparent to the caller, it thinks i...)
 
m (Typo fixed to a more precise definition)
Line 2: Line 2:
__NOTOC__
__NOTOC__


A '''memorizing table''' is a normal table with a metatable designed to find missing values and save them.  The mechanics are transparent to the caller, it thinks it's just doing a normal lookup.
A '''memoizing table''' is a normal table with a metatable designed to find missing values and save them.  The mechanics are transparent to the caller, it thinks it's just doing a normal lookup.


Memorizing tables are especially handy for caching values which are expensive to lookup or calculate.  The developer generally expects that for a given index the value won't change, so it does not need to be recomputed after the first lookup.
Memoizing tables are especially handy for caching values which are expensive to lookup or calculate.  The developer generally expects that for a given index the value won't change, so it does not need to be recomputed after the first lookup.


== Code ==
== Code ==
Anonymous user