Lua idioms compiled in one place
Asked Answered
I

3

6

I am using Lua for some of my apps. I am looking for a central repository of Lua idioms because I don't want to write C in Lua.

A few examples I've come across are:

x = x or v

This sets a default value for x if it is not already set.

Another is

x, y = y, x

to exchange two variables.

Iceman answered 24/1, 2011 at 2:43 Comment(0)
R
2

There are a whole bunch of useful snippets and idioms in these links:

http://lua-users.org/wiki/SampleCode

http://www.luafaq.org

Ruffle answered 24/1, 2011 at 8:28 Comment(0)
A
2

Lua Patterns, Tips and Tricks here on Stack Overflow is also very good read.

Adama answered 24/1, 2011 at 8:39 Comment(3)
Well it may well have been, but it was blockwarted.Ludhiana
This is a dead link :(Capparidaceous
Formatting didn't survive well, but: web.archive.org/web/20100609035807/http://stackoverflow.com/…Pantaloon
E
1

Try http://lua-users.org/wiki/LuaDirectory - that and the Lua manual/PiL are probably your two best resources in this regard.

Elconin answered 24/1, 2011 at 2:48 Comment(2)
If you mention the Manual, you should mention PiL as well. :-)Sweetmeat
My first reaction to that comment was to think amusedly "wait, you mean PiL isn't the Lua manual?" ;)Elconin

© 2022 - 2024 — McMap. All rights reserved.