lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Nov 18, 2011, at 2:27 PM, Dirk Laurie wrote:

> 1. unpack = unpack or table.unpack
> 2. Don't use # or the table library on non-sequences.
> 3. Don't use goto.
> 4. Write modules to return a table containing everything and load them by
>    mymod = require "mymod"
> 5. Load bit32 explicitly if you need it.

6. Always require module explicitly 
7. Don't use (set|get)fenv.
8. Don't use _ENV
9. Don't yield across language boundary 
10. Don't use the new meta methods

Other random stuff from the release notes:

	• Function module is deprecated. Modules are not expected to set global variables anymore, and it is easy to set up a module with regular Lua code.
	• Functions setfenv and getfenv are deprecated, because of the changes in environments.
	• Function math.log10 is deprecated. Use math.log with 10 as its second argument, instead.
	• Function loadstring is deprecated. Use load instead; it now accepts string arguments and are exactly equivalent to loadstring.
	• Function table.maxn is deprecated. Write it in Lua if you really need it.
	• Function os.execute now returns true when command terminates successfully and nil plus error information otherwise.
	• Function unpack was moved into the table library and therefore must be called as table.unpack.
	• Character class %z in patterns is deprecated, as now patterns may contain '\0' as a regular character.
	• The table package.loaders was renamed package.searchers.
	• Lua does not have bytecode verification anymore. So, all functions that load code (load and loadfile) are potentially insecure when loading untrusted binary data. (Actually, those functions were already insecure because of bugs in the verification algorithm.) When in doubt, use the mode argument in function load to restrict it to loading textual chunks.

http://www.lua.org/work/doc/#changes

And some more:
http://www.lua.org/work/doc/manual.html#8


There was also a nice blog post a while back highlighting many of the changes between 5.1 and 5.2. Cannot find a link though :/

Ah, yes, here you go:

http://www.corsix.org/content/look-lua-52-work3

In short, good luck! :)