lua-users wiki: Lua Five Two (original) (raw)
![]() |
---|
Lua 5.2 is the latest major revision[1] of Lua following 5.1. This page has some information the mailing list during alpha/beta testing that may be out-of-date or incorrect. Official information and downloads on Lua 5.2 are at [www.lua.org/manual/5.2\].
Scope
While 5.1.x versions are strictly bug-fix only versions of 5.1[12][13][2], Lua 5.2 was allowed to make design changes that break full compatibility.
History
- 2011-12-16, Lua [5.2.0-final] [rc8] [rc7] [rc6] [rc5] [rc4] [rc3] [rc2] [rc1]
- 2011-07-13, Lua [5.2.0-beta] [rc7] [rc6] [rc5] [rc4] [rc3] [rc2] [rc1] ; [Corsix: Annotated 5.2 Reference Manual][14]
- 2010-11-16, Lua [5.2.0-alpha] [rc4] [rc3] [rc2]
- 2010-07-31, Lua 5.2.0-work4 [15]
- 2010-05-18, Lua 5.2.0-work3 [16] (work release) posted. [review of source changes] (Peter Cawley)
- 2010-01-13, Lua 5.2.0-work2 [17]
- 2010-01-08, Lua 5.2.0-work1 [18][changes]
- Feb 2008, there is no complete list of changes nor a scheduled release date.[3]
Background Information
- [The Novelties of Lua 5.2] - Slides by Roberto, September 2011.
Note
Feel free to update references! (As well as anything else here.) -- AlexanderGladysh
TODO: Some sections below may need updated to reflect the final Lua 5.2.0 version.
Emergency garbage collector
Lua core forces a GC when allocation fails.
References:
- EmergencyGarbageCollector
- "The Novelties of Lua 5.2" above
Generational garbage collector (optional and experimental)
- [manual: Garbage Collection] - "As an experimental feature in Lua 5.2, you can change the collector's operation mode from incremental to generational. A generational collector assumes that most objects die young, and therefore it traverses only young (recently created) objects. This behavior can reduce the time used by the collector, but also increases memory usage (as old dead objects may accumulate). To mitigate this second problem, from time to time the generational collector performs a full collection. Remember that this is an experimental feature; you are welcome to try it, but check your gains."
- [manual: collectgarbage]
"generational"
- [manual: lua_gc]
LUA_GCGEN
- "The Novelties of Lua 5.2" above
Ephemeron tables
Tables with weak keys only visit value when key is accessible.
References:
- GarbageCollectingWeakTables
- [WS08 - Eliminating Cycles in Weak Tables]
- [4]
- [Wikipedia:Ephemeron]
- [Ephemerons: a new finalization mechanism]
- "The Novelties of Lua 5.2" above
Userdata with finalizers
Userdata with finalizers are kept in a separated list for the GC
References:
- LuaList:2008-02/msg00720.html - announce
Non-string error messages
Lua interpreter better handles non-string error messages.
References:
- LuaPowerPatches "Custom error object support" - patch for 5.1
- LuaList:2010-01/msg00505.html - announced
xpcall() improved
xpcall() now accepts arguments for the callback just like pcall() does
References:
- LuaList:2004-08/msg00265.html - proposal
- LuaList:2006-02/msg00536.html - proposal
- LuaList:2006-08/msg00031.html - proposal
- LuaList:2007-11/msg00592.html - planned
- LuaList:2010-01/msg00536.html - announced
package.searchpath()
New function package.searchpath() to search for your files just like require() does.
References:
- LuaList:2008-02/msg00686.html - planned
- LuaList:2010-01/msg00536.html - announced
package.config
Compile-time module system settings, available in package.config, are now documented.
References:
- LuaList:2006-07/msg00089.html - observed in 5.1
- LuaList:2010-01/msg00481.html - question why not a table
- LuaList:2010-06/msg00193.html - question why not a table
- [package.config] - reference manual draft
__pairs and __ipairs
Loop iteration can be overloaded now with the help of new __pairs and __ipairs metamethods.
References: GeneralizedPairsAndIpairs
__len
All types except string now respect __len metamethod. Previously, __len was not respected for table.
References:
- [Manual, 2.4 � Metatables and Metamethods]
- LuaVirtualization - proposal
- GeneralizedPairsAndIpairs - proposal
- LuaList:2006-01/msg00158.html - proposal
%q improved
string.format("%q") now escapes control characters.
References:
- LuaList:2007-07/msg00364.html - planned
Goto statement (includes simulating continue and labeled break statements)
References:
- GotoStatement
- ContinueProposal - proposal
- LuaList:2010-01/msg00816.html - proposal
Hexadecimal notation in string literals
You can write \xFF in strings in addition to old \255 notation.
References:
- LuaList:2009-06/msg00219.html - planned
Hexadecimal fractions and exponents in numerical literals
You can write numerical constants of the form 0x0.A or 0xA23p-4. In the latter case the 'p' indicates a binary exponent expressed in decimal (the manual does not make this clear: I assumed the exponent would be hexadecimal like the other parts). This feature is probably not useful in hand-written code but it allows precise de-serialisation of numbers serialised using the hexadecimal option of string.format.
However despite the inclusion of an official bit manipulation library, binary literals are still not supported.
References:
- [Manual, 3.1 � Lexical Conventions]
- LuaList:2011-12/msg00035.html - 5.1 patch for hex floats
- LuaList:2011-12/msg00036.html - LuaJit 2 patch for hex floats
- LuaList:2011-12/msg00025.html
- LuaList:2011-08/msg00173.html
- LuaList:2010-12/msg00150.html
- LuaList:2007-01/msg00530.html - msvc strtod2
- LuaList:2009-02/msg00089.html - lack of
%b
instring.format
/sprintf
- LuaList:1997-07/msg00019.html - binary literals
- Hex and binary literals map 1-1 in four-bit chunks. 0xF01 -> 1111 0000 0001 b. Therefore, hex notation is usually sufficiently convenient for representing binary data. Also, hex can be more readable in being less prone to mistakes in counting the number of 1' and 0's in a long bit string: 111100000001.
- But an alternative view is that both Hex and Binary should be supported. Binary is better for working with hardware registers where bitfields are not necessarily aligned in four-bit chunks and do not necessarily represent numbers at all. Many uses of the new bit32 library will be clearer with binary literals rather than hexadecimal.
- LuaPowerPatches - Patch to add binary literals in Java/Python style with embedded underscores for readability.
Safer os.date()
os.date() now allows ANSI C options only.
References:
- LuaList:2007-04/msg00511.html - proposal
luaL_testudata()
New luaL_testudata API function, similar to luaL_checkudata, but signaling invalid userdata to the caller rather than throwing an error.
References:
- LuaList:2009-06/msg00516.html - proposal
- LuaList:2009-06/msg00551.html - planned
Constant folding simplified
Division and modulo operations are no longer folded if the second argument is zero..
References:
- LuaList:2007-02/msg00212.html - planned
More freedom to yield()
Now you may yield() accross metamethods, for loop iterators pcall and xpcall calls and now-undocumented table.foreach[i] calls.
Also, C API calls are provided to implement your own yield-compliant C functions.
- Based on ResumableVmPatch [19].
- "The Novelties of Lua 5.2" above
Bitwise operations module
Now you can manipulate bits in Lua without the help of 3rd party modules or patches. None of existing implementations was used though.
References:
- BitwiseOperators - proposals
- LuaList:2008-02/msg00720.html - announcement for some bitlib
- LuaList:2008-02/msg00741.html - bit library not bit syntax operators
- LuaList:2009-06/msg00264.html - confirmation
- LuaList:2010-01/msg00290.html - controversy (Lua Bit``Op)
luaL_tolstring()
Now luaL_tolstring is documented. You may officially convert Lua values from C by the tostring() rules.
References: [20]
New functions: lua_tonumberx and luatointegerx
References:
- LuaList:2010-07/msg00862.html - announce 5.2.0work4
Lexical environments
_ENV
References:
- LuaList:2010-02/msg00753.html - planned
- LuaList:2010-06/msg00317.html - comments
- "The Novelties of Lua 5.2" above
getfenv() / setfenv() deprecated
getfenv() and setfenv() are deprecated in favor of the new lexical environments. Debug library counterparts are still there.
References:
- LuaList:2010-02/msg00753.html - planned
function/closure construction optimization
Cache anonymous functions/closures for reuse. This optimization is now possible with the removal of getfenv/setfenv. TODO:add better description and examples.
- LuaList:2010-05/msg00617.html - proposal / patch
- LuaList:2010-07/msg00375.html - planned
- LuaList:2010-07/msg00862.html - announce in 5.2.0work4
loadin()
New loadin(env,chunk) function to load chunk in a given environment. Note that the chunk
argument can also be a string.
fn,err = loadin({x=1,y=2},"return x+y")
References:
- LuaList:2010-08/msg00236.html - concise description
load() chunk type filter
It is possible to forbid load()-ing of bytecode and/or source code chunks. Bytecode verification on load was removed.
References:
- LuaList:2009-03/msg00039.html - planned
Lua thread environment
Lua threads (a.k.a coroutines) no longer have separate environments.
References: (Anyone?)
ABI and bytecode incompatibility
As expected Lua 5.2 ABI and bytecode is incompatible with 5.1.
References:
- LuaList:2010-02/msg00753.html - "There are no more GETGLOBAL/SETGLOBAL opcodes." - Roberto Ierusalimschy
Deprecated features from 5.1
Almost all deprecated features from 5.1 were removed. New deprecated features are off by default.
References: (Anyone?)
Debug module no longer loaded by default
If you need it, require() it.
Assuming this refers to the debug library, it does not seem to be the case in the release version - the debug library is in the list loaded by luaL_openlibs
. --JohnHind
References:
- Source file
linit.c
Coroutine library promoted to a fully-fledged library
Previously the coroutine library was a sub-library loaded by the basic library loader function. In 5.2 it has been given its own loader function and promoted to a normal library. It is included in the list loaded by luaL_openlibs
so this change is only important if your runtime does not use luaL_openlibs
.
The manual has a slight error: this change is reflected in section 6, but section 6.2 still refers to it as "a sub-library of the basic library".
References:
- [5] - Lua 5.2 Reference Manual
- Source files
linit.c, lcorolib.c
debug.getlocal parameter names
debug.getlocal gets parameter names of inactive functions. In debug.getlocal ([thread,] f, local)
, "The parameter f may also be a function. In that case, getlocal returns only the name of function parameters."
References:
- LuaList:2010-07/msg00862.html - announce in 5.2.0work4
Upvalue manipulation
New functions to detect if two upvalues are the same and to join them together if they are not:
- debug.upvalueid()
- debug.upvaluejoin()
- lua_upvalueid()
- lua_upvaluejoin()
References:
- LuaList:2008-02/msg01173.html - proposal
- LuaList:2010-01/msg00536.html - announce
Additional debug info
debug.getinfo() and lua_getinfo() now return extra information about function on call stack:
- Was it called via tail call?
- Number of upvalues.
- Number of arguments.
- Is this a vararg function?
References: (Anyone?)
Pattern: %f is documented
The frontier pattern is now documented.
References:
- FrontierPattern
- LuaList:2004-09/msg00294.html - comments, roberto
- LuaList:2009-12/msg00891.html - comments
- LuaList:2009-12/msg00978.html - comments
Pattern: %g
New pattern %g
represents all printable characters except space.
- LuaList:2010-07/msg00862.html - announce in 5.2.0work4
string.gsub repl
string.gsub
[6] now raises an error if the replacement string contains a '%' followed by a character other than the permitted '%' or digit.
ipairs behaviour change (this feature has been retracted)
Now ipairs() iterates over #t elements of the table. In 5.1 it did until first nil.
- In 5.2-work4 it again is going until the first nil.
References: Source code: lua-5.2.0-work4/src/lbaselib.c line 213
select() negative numbers
You may pass negative index to select() to get arguments from the end of the vararg (in the direct order).
References:
- LuaList:2010-03/msg00223.html - proposal
math.log10() vs. math.log()
math.log10() is deprecated. Use 10 as new second argument of math.log().
References: (Anyone?)
table.maxn() removed
table.maxn is deprecated.
References:
- LuaList:2004-11/msg00054.html - plan table.maxn
- LuaList:2005-11/msg00008.html - announce table.maxn 5.1beta
- LuaList:2006-01/msg00350.html - proposal "maxn considered pointless"
- LuaList:2006-01/msg00352.html - proposal
- LuaList:2009-11/msg00045.html - proposal
table.unpack() and table.pack()
unpack() is renamed to table.unpack(). table.pack() is added, packing arguments to a table and storing number of arguments to table's field "n".
References:
- LuaList:2010-01/msg00329.html - comments
- LuaList:2010-01/msg01427.html - comments
Enhanced pipe support
If file was opened by io.popen(), file:close() returns process' exit code.
References:
- LuaList:2006-04/msg00172.html - proposal
- LuaList:2009-06/msg00124.html - proposal
- LuaList:2009-09/msg00002.html - proposal
- [readme] - announced
Better stopped GC handling
Calling collectgarbage("step") no longer restarts GC if it was stopped. Also, you may know if GC was stopped by calling collectgarbage("isrunning"). Of course you may do the same in C API.
References: (Anyone?)
Identifier's locale
Lua identifiers may no longer use locale-dependent characters.
References:
- LuaList:2009-11/msg00999.html - proposal/planned
New Registry fields
The following is a complete list of Lua's use of the registry table (at pseudo-index LUA_REGISTRYINDEX
) in the 5.2.0 release.
Installed by lua_newstate
- [1] = (LUA_RIDX_MAINTHREAD) The main thread of the Lua state containing the registry table.
- [2] =
(LUA_RIDX_GLOBALS) The default environment which functions get for globals as _ENV upvalue.
- LUA_RIDX_CPCALL in prerelease versions has been retracted.
- Integer keys from [3] up are reserved for allocation by luaL_ref.
Installed by 'package' library loader
- ["_LOADED"] =
Reference to the table
package.loaded
- ["_PRELOAD"] =
Reference to the table
package.preload
- ["_LOADLIB"] =
Metatable for external 'C' libraries to attach to their library tables.
Installed by 'IO' library loader
- ["_IO_output] = File descriptor for default output file.
- ["_IO_input] = File descriptor for default input file.
- ["FILE*"] =
Metatable for 'file' objects.
The manual states: "As with global names, string keys starting with an underscore followed by uppercase letters are reserved for Lua." Note however that Lua does not rigerously follow this rule as with the "FILE*" key.
The metatable for strings has not been referenced in the registry, but it simply indexes the string library table itself, so functions added to that will automatically work as methods of string objects.
References:
- [7] - Lua 5.2 Reference Manual - 4.5 - Registry
Light C functions / lua_cpcall improvements
lua_pushcfunction no longer allocates. This is more efficient and doesn't raise on failure. It also eliminates the need for lua_cpcall(), which has been removed from the API. Furthermore, a version of lua_cpcall supporting multiple arguments and return values is no longer needed either since lua_pcall now can do this.
- LuaList:2005-02/msg00433.html - proposal
- LuaList:2009-07/msg00417.html - proposal (Lua 5.1 implementation)
- LuaList:2010-01/msg00536.html - announce first implementation
- LuaList:2010-03/msg00271.html - comments
- LuaList:2010-03/msg00409.html - comments
- LuaList:2010-03/msg00942.html - comments
- LuaList:2010-05/msg00331.html - announce light C functions
- LuaList:2010-05/msg00562.html - comments
- LuaList:2010-05/msg00357.html - comments
- "The Novelties of Lua 5.2" above
LUA_GLOBALSINDEX removed
If you need one, use LUA_RIDX_GLOBALS from the registry (or LUA_ENVIRONINDEX if you didn't changed your C function environment).
References: (Anyone?)
lua_getglobal(), lua_setglobal(), and lua_register()
These functions work with C function environment instead of state's global environment to better reflect the way Lua works with global variables.
References: (Anyone?)
luaL_typerror() deprecated
References:
- LuaList:2007-11/msg00023.html - proposal to rename to luaL_typeerror
- LuaList:2010-05/msg00537.html - comments
- 5.2.0-alpha says "luaL_typerror was deprecated. Write your own version if you need it"
lua_compare()
New function lua_compare() was added to replace deprecated lua_equal() and lua_lessthan().
References:
- LuaList:2009-06/msg00418.html - proposal
- LuaList:2010-01/msg00536.html - announce
lua_arith()
New function lua_arith() to do arithmetics with Lua values the way Lua does it.
References:
- LuaList:2009-06/msg00418.html - proposal
- LuaList:2010-07/msg00123.html - question on LUA_OPUNM
- [8] - LUA_OPUNM patched in 5.2.0work4
- [9] - reference manual
Object length from C
lua_objlen() was renamed to lua_rawlen(). lua_len() was added to honor __len metamethod.
References:
- LuaList:2010-01/msg00536.html - announce 5.2.0work1
- LuaList:2010-01/msg00897.html - comments
lua_checkstack() updated
lua_checkstack is now only returns error codes (never raises). Use luaL_checkstack if you want to raise (with error string).
References:
- LuaList:2009-07/msg00440.html - proposal (others?)
- LuaList:2010-01/msg00434.html - comments, approval
- LuaList:2010-03/msg00944.html - comments, roberto
- LuaList:2009-03/msg00014.html - comments
lua_pushstring() and lua_pushlstring() enhanced
Now they return pointers to the internal string representations.
References: (Anyone?)
lua_copy()
Allows to copy Lua values on stack (replacing existing value in the target slot).
References:
- LuaList:2010-03/msg00111.html - proposal, announce
- LuaList:2010-01/msg00536.html - announce
Lua runtime version checks
Two new functions were added, lua_version() and luaL_checkversion() to let user check runtime versions and address space correctness. This would help to prevent dreaded obscure bugs when several Lua instances are linked to the executable. luaL_checkversion() is called from luaL_register(), so such checks would be performed automatically when most modules are require()-d.
References:
- LuaList:2002-12/msg00121.html - announce 5.0 beta (later retracted?)
- LuaList:2009-06/msg00147.html - proposal
- LuaList:2010-01/msg00536.html - announce 5.2.0work1
- LuaList:2010-01/msg01034.html - comments
luaL_traceback()
New function to produce stacktraces just like debug.traceback() does.
References:
- LuaList:2010-01/msg00294.html - comments, approval
- [luaL_traceback] - reference manual draft
LUA_ERRGCMM and LUA_OK
LUA_ERRGCMM is a new runtime error code to signify error in __gc metamethod. LUA_OK was added to keep symmetry and means that all went OK and there were no errors.
References:
- LuaList:2010-01/msg00536.html - announce
- LuaList:2010-05/msg00553.html - comments
- [luaL_load][luaL_pcall] - reference manual draft (LUA_OK is in various other places)
Better dynamic library loading on *nix
Now Lua C modules may load dynamic libraries with global symbols (thanks to RTLD_GLOBAL).
References: (Anyone?)
Dynamic library loading on Windows improvements
DLL search path handling was improved on Windows.
- Supports LUA_LLE_FLAGS=LOAD_WITH_ALTERED_SEARCH_PATH preprocessor option, using
LoadLibraryEx
. - LoadLibrary - has more details, including issues still remaining in 5.2.
More constants per chunk
Maximum number of constants per chunk increased to 2^26 from 2^18. Go, huge table dumps!
References:
- LuaList:1999-01/msg00004.html - proposal
- LuaList:1999-07/msg00006.html - announce: 2^16 to 2^24 (Lua 3.2)
- LuaList:2005-03/msg00126.html - proposal
- LuaList:2007-06/msg00220.html - proposal
- LuaList:2008-02/msg00255.html - proposal
- LuaList:2008-05/msg00284.html - proposal
- LuaList:2009-08/msg00099.html - proposal
- LuaList:2010-01/msg00536.html - announce: 2^18 to 2^26 (Lua 5.2.0work1)
- LuaList:2010-03/msg00238.html - comments, LuaJIT
Parser optimizations
Parser eats less c-stack space as it no longer uses auto arrays.
References:
- LuaList:2001-01/msg00040.html - related?
- LuaList:2010-01/msg00536.html - announce
New floating point hash function
New hash function for floating point values to better handle cases when lua_Number is defined as long double on some 64-bit platforms.
References:
- LuaList:2010-01/msg00536.html - announce
file:write() improved
file:write() returns file to allow chained calls.
References:
- LuaList:2010-01/msg00536.html - announce
end-of-line character preservation in new file:read end file:lines
A new "*L" option to file:read is like "*l" but keeps end of line (if present). Also, a new keepNL
argument in file:lines
keeps new lines.
- LuaList:2010-02/msg00831.html - proposal
- [file:read] - reference manual draft
- [file:lines] - reference manual draft
os.exit() improved
It may optionally call lua_close() on the Lua state.
References:
- LuaList:2010-01/msg00536.html - announce
os.execute() interface change
"Function os.execute now returns true when command terminates successfully and nil plus error information otherwise." [10]
Examples:
$ lua51 -e "os.exit(3)"; echo $? 3 $ lua51 -e 'print(os.execute[[lua -e "os.exit(3)"]])' 768 $ lua52 -e 'print(os.execute[[lua -e "os.exit(3)"]])' nil exit 3 $ perl -e 'print(system(qq(perl -e "exit(3)")),"\n")' 768 $ python -c "import os; print(os.system("python -c 'import os; os._exit(3)'"))" 768
Call``Info stack now is a linked list
??
References:
- LuaList:2010-01/msg00536.html - announce
Resolve module system and module function issues
The module/luaL_register
functions are deprecated and replaced by luaL_newlib and luaL_setfuncs. There is also a new function luaL_requiref
.
I believe this is a much more significant change than the manual or other material suggest. On the face of it, where you could previously write require 'coroutine'
for example, you now have to write coroutine = require 'coroutine'
. This is definitely a useful improvement, but if I have understood it correctly, it will break a lot of existing code. The 'changes' section of the manual is not sufficiently explicit about this. Worse, the documentation for require
does not clearly state the purpose of the return value. You have to read between the lines that the intent is to return either the module's global table or the value 'true' if the module does not export a global table (delivering this intent depends on the module loader following some rules, which are not explicitly stated).
The manual says "Once a loader is found, require calls the loader with two arguments: modname and an extra value dependent on how it got the loader. [...] If the loader returns any non-nil value, require assigns the returned value to package.loaded[modname]. If the loader does not return a non-nil value and has not assigned any value to package.loaded[modname], then require assigns true to this entry. In any case, require returns the final value of package.loaded[modname]." How is that not clear? One thing, I might add, however, is that allowing true
, rather than a module table, to be assigned to package.loaded[modname]
is normally something to be avoided and is rather a fallback behavior, lacking any better value to use, to at least ensure that the module loader isn't executed more than once on multiple require calls. Now, concerning exactly what the loader should return, it should normally be a table [21], but the official Lua reference manual might be silent on this because of the MechanismNotPolicy design principle. Sometimes module loaders return functions (normally object constructors), though perhaps it would be preferable to return FuncTables (i.e. a table with a call operator) since it's quasi-standard for require'foo'._VERSION
to represent the module version (ModuleVersioning), which remains possible with FuncTables. BTW, the module
function, though deprecated in 5.2, is still available unless you turn off deprecated features, and the call to module
sets package.loaded[modname]
(as well as a global). --DavidManura
Compare luaL_requiref
(C API) with require
(Lua): the latter just takes the module name, while the former takes the module name, the library loader function and a flag which you set 'true' to store the return from the loader function in a global with the same name as the library. luaL_openlibs
uses luaL_requiref
with this flag set. Hence it will open the standard libraries with their global tables initialised as expected. However libraries opened from Lua with require
must set the global explicitly using the returned value.
Please feel free to correct the above two paragraphs if they are misconceived!
luaL_requiref
I consider to be just a convenience function for certain cases like linit.c. For example, it assumes the loader is a C function (lua_CFunction) and the destination table is LUA_RIDX_GLOBALS
, so it's not entirely general. The "must set the global explicitly" is not really true since it's normally preferred to set a local explicitly, local foo = require 'foo'
, which doesn't tamper with _G
. --DavidManura
Sorry DavidManura, I did not really intend to open a policy discussion/critique, just to warn others about a practical problem I just discovered the hard way. My runtime does not load most of the standard libraries by default but instead puts their loader functions in the preloads
table (I do this to save RAM). After converting from 5.1.4 to 5.2 I found that Lua with e.g. require 'coroutine'
no longer worked and I had to change it to coroutine = require 'coroutine'
. This leads to the consideration that, if third-party library developers follow the example (I will not say policy) set by the standard libraries, then they too may break existing Lua code. Most users will not notice this change with respect to the standard libraries because runtimes usually load these by calling luaL_openlibs
which in turn calls luaL_requiref
. -- JohnHind
References:
- LuaModuleFunctionCritiqued
- LuaList:2010-06/msg00494.html - RFC on luaL_register, roberto
- LuaList:2010-07/msg00862.html - announce in 5.2.0work4
- "The Novelties of Lua 5.2" above
Version-specific environment variables
Added environmented variables LUA_PATH_5_2, etc.
- LuaList:2010-07/msg00862.html - announce in 5.2.0work4
What we wouldn't get in 5.2
...Or would we?
You're welcome to put your pet feature here, assuming it was supported by someone else on the list AND was declined by Lua authors for inclusion into 5.2. Please be polite. --AlexanderGladysh
string.pack/string.unpack
Something along the lines of struct/lpack
References:
- StructurePacking - proposals
- LuaList:2008-02/msg00729.html - comments
Decline motivation: (Have a link?)
Token filters
Or other "meta" facility.
References:
- MetaProgramming - proposals
- LuaList:2006-10/msg00722.html - lhf comment
- "The Novelties of Lua 5.2" above
Decline motivation: (Have a link?)
#line directive
This would be similar to the C preprocessor's #line
directive [11]. The main motivation is to allow preprocessors to output this in generated Lua code so that debugging line numbers and file names correspond to the original (prior to preprocessing) source code.
- LuaList:2011-10/msg00770.html - discusses patch to Proto (Jensen)
- LuaList:2011-10/msg00703.html - #line mentioned (Donovan)
- LuaList:2011-09/msg00269.html - suggestion for traceback error handler rewriting line numbers instead
- LuaList:2011-08/msg00332.html - Moon
Script "line number reversal, so errors that happen in the compiled Lua are rewritten to point back to the original Moon
Script line" - LuaList:2011-08/msg00910.html - "C preprocessor style #line support".
- LuaList:2011-08/msg00911.html - Mentions problem of "one filename per Proto" restriction. Also noted by Pall in LuaList:2011-10/msg00711.html in respect to LuaJit.
- LuaList:2011-06/msg00772.html - relationship to goto/labels.
- LuaList:2011-06/msg00707.html - #line mentioned
- LuaList:2011-06/msg00586.html - #line mentioned (Donovan)
- LuaList:2011-01/msg01410.html - #line mentioned (Donovan)
- LuaList:2010-02/msg00889.html - #line mentioned (Donovan)
- LuaList:2009-05/msg00288.html -
__LINE__
for SourceOptimizer - LuaList:2005-06/msg00111.html - Lhf patch to lexer to alter line numbers (but not file names)
- LuaList:2001-06/msg00131.html ; LuaList:2001-06/msg00132.html - Lhf
Removal of automatic coercions
- "The Novelties of Lua 5.2" above
lua_rawtostring / rawtostring
Get a string without coercions from numbers.
References:
- [luafiveqplus] implements this, as "hash.pstring"
- LuaList:2011-05/msg00028.html - "Getting the 'ID' of an object"
- LuaList:2009-02/msg00421.html - "rawtostring()"
- LuaList:2008-02/msg00768.html
- LuaList:2006-10/msg00005.html
- LuaList:2006-07/msg00003.html
- LuaList:2004-09/msg00421.html - "Lua5.1 suggestion: rawtostring()"
- LuaList:2004-01/msg00173.html - "rawtostring()"
Decline motivation: (Have a link?)
Hyphens in module names
Module version number is currently expected to be on the left side of the name, which is rather unusual.
References:
- LuaList:2009-07/msg00074.html - planned
Decline motivation: (Have a link?)
Improving deterministic resource cleanup
Replace package.seeall with something like package.clean
Replace package.seeall with something analogous to the package.clean
solutions in ModuleDefinition, but updated to support _ENV. package.seeall doesn't separate the public module table with the private implementation environment.
References:
- ModuleDefinition
- [luafiveqplus] implements this
Suggestions
Some features/changes proposed by users for 5.2 are listed in FeatureProposals. Requests should be posted to the mailing list.
See Also
- [1] Lua version history
- [22] Initial list of planned changes in 5.2 posted by Roberto Ierusalimschy (2008-02-19)
- FeatureProposals
- The history of Lua (see [The Evolution of Lua])
- [A look at Lua 5.2 (work3)] - changes between 5.1 and 5.2-work3 (corsix.org)
- [Lua Unofficial Frequently Asked Questions] - contains section on 5.2
RecentChanges · preferences
edit · history
Last edited May 19, 2012 9:00 pm GMT (diff)