Hacker News new | ask | show | jobs
by appleorchard46 499 days ago
Very cool! I was just needing something like this for my Defold game, this looks way better than my hacky solution.

Semi-unrelated - you say you're using tables as keys in your project. I didn't know you could do that! What are you using it for?

2 comments

For example, you want to keep a set of objects -- then the objects themselves would be keys, and values would be true/nil. Or there is a good example in one of ldump's recent issues: https://github.com/girvel/ldump/issues/44, where the loaded packages are stored in a table as keys to easily detect external module usage.
FWIW anything in Lua can be used as a key - including functions, userdata, etc.