___________________________________________________________________________________________________________________________
Lib:fun is a port of Roman Tsisyk's Functional Lua library to Wildstar. It enables the use of many common functions found in functional programming languages within Wildstar addons, such as map, filter, and reduce.
Fun is a small wrapper addon that provides an alternate method of access by wrapping all the functions into the Fun table and making it globally accessible. This may be desirable for use with /eval, the GeminiConsole in-game REPL, or for early addon development that uses lib:fun. This avoids needing to load the lib manually in GeminiConsole, which helps with in-game testing and early development. If it proves useful for the addon, lib:fun can then be included in the addon itself with minimal change to the code.
There is also now a second file, fun-extra, that provides my own constructs for other FP-esque things I miss. fun-extra contains the following:
Import all using `lib:fun` in an addon:
f = Apollo.GetPackage("lib:fun").tPackage f.each(Print, f.range(3))
Import specific functions from lib:fun in an addon:
ar = {'each', 'range'} f = Apollo.GetPackage("lib:fun").tPackage.import(ar) f.each(Print, f.range(3))
Using the global Fun addon (such as with GeminiConsole):
Fun.each(Print,Fun.range(3)) --- direct use f = Fun --- binding to another name f = Fun.import({'head', 'tail'}) --- binding specific functions from Fun
_G pollution of globals:
[BEWARE] Doing this affects all addons and is a really bad idea. It's only listed for completeness. Seriously, don't do this, especially in release code.
for k,v in pairs(Apollo.GetPackage("lib:fun").tPackage) do _G[k] = v end each(Print, range(3))
About Project
Created: December 18th 2023
Updated: December 18th 2023
Project ID: 91335
License: All Rights Reserved
__________________________________________
Game Versions:
1.01.03
1.01.03
1.01.03
1.01.03
1.01.03
__________________________________________
Flavors:
WoW Retail
__________________________________________
Categories
Companions
Battle
__________________________________________
Main File
December 18th 2023
__________________________________________
Recent File
December 18th 2023
__________________________________________
Members
__________________________________________
Report