Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lua idioms compiled in one place

Tags:

lua

iphone-wax

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.

like image 693
John Smith Avatar asked Jan 24 '11 02:01

John Smith


Video Answer


1 Answers

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

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

http://www.luafaq.org

like image 168
jpjacobs Avatar answered Sep 20 '22 17:09

jpjacobs