LUA and overloading

I am coding some mod in LUA for some game and I hit a snag and it actually took me quite some time to solve it due to several functionalities not available through LUA to control some of the interface elements and thus transformed the snag into lots of small snags to get what I wanted to work.

But the last snag I hit, after clearing the others, was really annoying, in the API there was a function like: removeSmthg(ID) but also removeSmthg(NAME). And being unfamiliar with the language as always I forgot that LUA doesn’t handle type-based function overloading, so only one of the function actually worked… the one I was not using. Once I found that out, it ended up being quite easy to actually do what I wanted at the start.

And because it is blogged, I should remember it next time!

Tags:

Leave a Reply

You must be logged in to post a comment.