Top "Lua" questions

Lua is a powerful, fast, lightweight, embeddable scripting language.

What's the difference between table.insert(t, i) and t[#t+1] = i?

In Lua, there seem to be two ways of appending an element to an array: table.insert(t, i) and …

lua lua-table
Lua: How to find out if an element is a table instead of a string/number?

As the title says, what function or check can I do to find out if a lua element is a …

lua lua-table
How to terminate Lua script?

How would I terminate a Lua script? Right now I'm having problems with exit(), and I don't know why. (This …

lua minecraft computercraft
get current working directory in Lua

What's the Lua to get the current working directory on Windows XP SP3 (or to get the directory of the …

windows-xp lua getcwd
Lua multiline comments past ]]'s

I'm trying to find out a way to use a multiline comment on a batch of code, but it keeps …

lua comments multiline
What is the difference of pairs() vs. ipairs() in Lua?

In a for loop, what is the difference between looping with pairs() and ipairs()? This page uses both: Lua Docs …

for-loop lua
How to install Torch on windows 8.1?

Torch is a scientific computing framework with wide support for machine learning algorithms. It is easy to use and efficient, …

lua windows-8.1 luajit torch
How to 'unpack' table into function arguments

I'm trying to call a function in Lua that accepts multiple 'number' arguments function addShape(x1, y1, x2, y2 ... xn, …

lua lua-table
Lua operators, why isn't +=, -= and so on defined?

This is a question I've been mildly irritated about for some time and just never got around to search the …

lua language-design assignment-operator compound-assignment
How do I get the number of keys in a hash table in Lua?

myTable = {} myTable["foo"] = 12 myTable["bar"] = "blah" print(#myTable) -- this prints 0 Do I actually have to iterate through the items …

lua hashtable