About 852,000 results
Open links in new tab
  1. What is the difference between pairs() and ipairs() in Lua?

    In a for loop, what is the difference between looping with pairs() versus ipairs()? The Programming in Lua book mentions both, however, both appear to generate similar outputs as shown below: …

  2. Why does Lua have no "continue" statement? - Stack Overflow

    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 …

  3. if statement - How to check if a value is equal or not equal to one …

    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 …

  4. installation - How to install Lua on windows - Stack Overflow

    I'm new to Lua, and need to know how to install it on Windows? I've tried and am unable to run the sample. When I try to compile it 100% success is shown, but when I click the run button it …

  5. lua - Define default values for function arguments - Stack Overflow

    In the Lua wiki I found a way to define default values for missing arguments: function myfunction(a,b,c) b = b or 7 c = c or 5 print (a,b,c) end Is that the only way? The PHP style

  6. filesystems - Get containing path of lua file - Stack Overflow

    I am wondering if there is a way of getting the path to the currently executing lua script file? This is specifically not the current working directory, which could be entirely different. I know

  7. How to add a "sleep" or "wait" to my Lua Script? - Stack Overflow

    Lua doesn't provide a standard sleep function, but there are several ways to implement one, see Sleep Function for detail. For Linux, this may be the easiest one:

  8. Split string in Lua - Stack Overflow

    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 …

  9. What is the alternative for switch statement in Lua language?

    In general, if you want a switch statement in Lua, what you ought to be doing is building a table. For your simple case of choice that could be 1, 2, or fail, a simple if statement with a few …

  10. What does # mean in Lua? - Stack Overflow

    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...