truemedian / luvit-api-design

11 stars 2 forks source link

Provide general-purpose utilities #17

Open RiskoZoSlovenska opened 2 years ago

RiskoZoSlovenska commented 2 years ago

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).

RiskoZoSlovenska commented 2 years ago

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.