Lua is a lightweight multi-paradigm programming language designed as a scripting language with extensible semantics as a primary goal.
Questions tagged [lua]
28 questions
58
votes
3 answers
Why Python and not Lua?
Why has Python been backed by google and become so rapidly popular and Lua has not?
Do you know why Lua has stayed in background?

BenjaminB
- 1,706
- 1
- 12
- 15
15
votes
7 answers
Function only returns unchanged parameter, useless?
I just found this function in the project I'm working at:
-- Just returns the text unchanged.
-- Note: may be nil, function must return nil in that case!
function Widget:wtr(text)
return text
end
Too sad, the coder does not…

jawo
- 270
- 2
- 11
15
votes
10 answers
Why do we need "callback functions"?
I am reading the book programming in Lua. It said that
Closures provide a valuable tool in many contexts. As we have seen, they are
useful as arguments to higher-order functions such as sort. Closures are valuable for functions that build other…

Lucas
- 721
- 2
- 8
- 15
11
votes
2 answers
How Lua handles both integer and float numbers?
As far as I remember myself programming I was taught not to compare floating point numbers for equality. Now, while reading Programming in Lua about Lua number type, I found following:
The number type represents real (double-precision…

Petr Abdulin
- 558
- 1
- 5
- 14
11
votes
2 answers
Should extension scripts be run in a sandbox?
In particular, this is about game extensions written in lua (luajit-2.0). I was contemplating whether I should restrict what these scripts can do, and arrived at the conclusion that I probably shouldn't:
It's hard to get right. Sounds silly, but…

Cubic
- 301
- 2
- 10
9
votes
3 answers
What does (Lua) game scripting mean?
I've read that Lua is often used for embedded scripting and in particular game for scripting. I find it hard to picture how it is used exactly.
Can you describe why and for which features and for which audience it is used?
This questions isn't…

Gere
- 2,191
- 2
- 17
- 21
7
votes
2 answers
Should I use Lua for writing config files?
I heard that Lua is great for configuration files, so long as you are secure about it. Lua has been used as config files by programs such as awesome and (recently) conky.
However, I also heard that using programming to configure a program is an…

Nolan Akash
- 1,294
- 2
- 10
- 11
7
votes
1 answer
Creating New Scripts Dynamically in Lua
Right now this is just a crazy idea that I had, but I was able to implement the code and get it working properly. I am not entirely sure of what the use cases would be just yet.
What this code does is create a new Lua script file in the project…

bazola
- 255
- 1
- 5
5
votes
2 answers
Alternative Scripting Language to Lua?
I would like to add scripting support to an applications and with plenty scripting languages available I am a bit overwhelmed.
At first I thought about Python but I guess Python is a little too big for my taste and the application (although I like…

wirrbel
- 3,018
- 2
- 21
- 33
5
votes
2 answers
Lua and multi-paradigm programming: scope and capabilities
Despite having started learning programming with Pascal and C, after the jump to OO (C++, Java) I lost sense of the structured programming paradigm. I have started learning Lua and I have researched many tutorials, but all of them only cover basic…

MLProgrammer-CiM
- 333
- 2
- 13
4
votes
2 answers
Criteria for a language (Terra as a tricky example) to be usable for operating system development, and how to meet missing criteria
For example, a language that I was looking at recently- Terra. You can address the question in the context of any language, I'm just most comfortable with Lua so I'm starting from there.
The Terra Language can be metaprogrammed with Lua and is…

Zachary Johnson
- 57
- 3
4
votes
2 answers
Simplifying Some Probabilistic If-Then Spaghetti Code
I've got a fairly substantial code base that I'm trying to simplify. One section in particular deals with probabilistically creating objects. It currently uses hundreds of random number generator calls in if-then statements to achieve the desired…

Christopher Sheaf
- 43
- 4
4
votes
2 answers
What is the point of designing Lua C APIs?
I am a newbie of Lua. After studying some Lua C APIs examples, I am a little confused.
I can see the Lua C API is used for processing Lua scripts:
......
lua_State *L = luaL_newstate();
luaL_openlibs(L);
luaL_loadfile(L, argv[1]);
lua_call(L, 0,…

Nan Xiao
- 143
- 4
3
votes
5 answers
Functional language with C-like syntax
I've been looking for functional language with C-like syntax and static typing. So far my choice would be Nemerle. Is there anything else/better?
EDIT:
second choice would be Lua or Go.
Any pros and cons?

Lukasz Madon
- 1,496
- 13
- 22
3
votes
1 answer
Is it better to accept a dictionary/table or arguments in a function?
In Lua, I can create an object like so:
local foo = Foo.new({10, 10}, 3, right)
or like so:
local foo = Foo.new({
pos = {10, 10},
len = 3,
direction = "right"
})
The former is more compact, whereas the latter is more understandable and…

Nolan Akash
- 1,294
- 2
- 10
- 11