|
|
|
|
|
by AstroJetson
3631 days ago
|
|
Thats why you use Lua, it lets you have multiple return values. So you can get a boolean back to let you know if the strings were the same, an int to know where they ceased matching and a boolean to let you know if they are case different. It's then up to the programmer to decide how much enlightenment they want. The destroy all IF reminds me of GOTO considered harmful of the 70's. There are other ways to fix the problem. |
|
Multiple return values feel elegant also because the compiler can optimize them away when you're not using them, which is the most common case.
[0] - http://clhs.lisp.se/Body/f_gethas.htm