luvit-api-design
luvit-api-design copied to clipboard
Provide general-purpose utilities
Lua's default libraries are relatively sparse and I oftentimes find myself repeatedly implementing certain common functions, such number clamping/rounding, table joining/merging/filtering/mapping, string padding/splitting and so on. I think it would be convenient if luvit provided these natively (and had them inserted into the global library tables, just like 2.x did with string.levenshtein
).
Suggestion for another function: table.setify
(probably will need to think of a better name) - Turns an array into a set of its values (i.e. {3, "hi"}
turns into { [3] = true, ["hi"] = true }
. Asking because I find it quite useful.