In Lua's case, the language is intended to be an embedded scripting language, so any changes that make the language more complex or potentially make the compiler/runtime even slightly larger or slower may go against this objective. If you implement each and every tiny feature, you can end up with a 'kitchen sink' language: ADA, anyone?
I have seen the hash character '#' being added to the front of variables a lot in Lua. What does it do? EXAMPLE -- sort AIs in currentlevel table.sort (level.ais, function (a,b) return a.y < b...
Because control structures in Lua only consider nil and false to be false, and anything else to be true, this will always enter the if statement, which is not what you want either. There is no way that you can use binary operators like those provided in programming languages to compare a single variable to a list of values.
Lua is a powerful, fast, lightweight, embeddable scripting language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics.
45 If you are splitting a string in Lua, you should try the string.gmatch () or string.sub () methods. Use the string.sub () method if you know the index you wish to split the string at, or use the string.gmatch () if you will parse the string to find the location to split the string at. Example using string.gmatch () from Lua 5.1 Reference Manual:
The Lua authors felt that continue was only one of a number of possible new control flow mechanisms (the fact that it cannot work with the scope rules of repeat/until was a secondary factor.)
As for the pure Lua solutions, let me share this small benchmark, I've made. It covers every provided answer to this date and adds a few optimizations. Still, the basic thing to consider is: How many times you'll need to iterate over characters in string? If the answer is "once", than you should look up first part of the banchmark ("raw speed").