luvit-api-design icon indicating copy to clipboard operation
luvit-api-design copied to clipboard

Provide general-purpose utilities

Open RiskoZoSlovenska opened this issue 2 years ago • 1 comments

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 avatar May 28 '22 00:05 RiskoZoSlovenska

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.

RiskoZoSlovenska avatar Sep 01 '22 23:09 RiskoZoSlovenska