General discussion about LÖVE, Lua, game development, puns, and unicorns.
4 posts • Page 1 of 1
Is it possible to search a table by value and return the first key with a matching value?
I actually just finished writing exactly that helper function, but I suppose I wondered if there was a built-in function. I believe this answers my question nonetheless :] Thank you Anjoanjo wrote:
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
I had exactly the same question some time ago. It is kind of incredible that Lua is so 'barebones' in some things. From the top of my head:
- lots of functions on string (not regular-expression based!)
- math.round (you can implement it like this: function math.round(x) return math.floor(x + .5) end)
- built-in directory support for require. They say "Lua in Ansi-C, and Ansi-C doesn't include directory support" . But I always found that a very lazy excuse.
When I write def I mean function.
Users browsing this forum: No registered users and 18 guests