Difference between revisions of "memoize.lua"
(Created page with "[http://love2d.org/forums/viewtopic.php?f=5&t=2867 Original forum thread ]. Latest version: https://github.com/kikito/memoize.lua memoize.lua is a library that takes a functio...") |
|||
Line 1: | Line 1: | ||
+ | {{#set:LOVE Version=any}} | ||
+ | {{#set:Description=Generic memoization for Lua.}} | ||
+ | |||
+ | [[Category:Libraries]] | ||
+ | |||
[http://love2d.org/forums/viewtopic.php?f=5&t=2867 Original forum thread ]. | [http://love2d.org/forums/viewtopic.php?f=5&t=2867 Original forum thread ]. | ||
Revision as of 21:35, 24 April 2011
Latest version:
https://github.com/kikito/memoize.lua
memoize.lua is a library that takes a function as parameter and returns a "cached" version of that function. The first time the function is called with some parameters, it will act normally.
The second time it's called, however, it will "remember" the data result from previous computations, and will recover it from the cache instead of recalculating it.
memoizing is useful for functions that take lots of time to compute, and always return the same output with the same input. It's also useful for functions that read data from the disk.