Lua Tricks

Post Reply
User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Lua Tricks

Post by Akaya »

A few simple tricks you may or may not know: http://www.computercraft.info/forums2/i ... ave-known/

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Lua Tricks

Post by Vadi »

All valid stuff. I'll add that using mytable[#mytable+1] = value is quicker than using table.insert(mytable, value) on there as the first thing.

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Lua Tricks

Post by Jor'Mox »

Interesting observation. Do you know if that becomes more or less the case as the table becomes REALLY big?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Lua Tricks

Post by Vadi »

I believe it still would be, yes. See http://www.lua.org/gems/sample.pdf (I recommend the entire Lua Gems book; I've got a print edition of it).

Additionally, see http://lua-users.org/wiki/OptimisationTips, http://lua-users.org/wiki/OptimisationCodingTips.

Post Reply