HISTORY 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. HISTORY for Lua 5.1
  2. * Changes from version 5.0 to 5.1
  3. -------------------------------
  4. Language:
  5. + new module system.
  6. + new semantics for control variables of fors.
  7. + new semantics for setn/getn.
  8. + new syntax/semantics for varargs.
  9. + new long strings and comments.
  10. + new `mod' operator (`%')
  11. + new length operator #t
  12. + metatables for all types
  13. API:
  14. + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
  15. + user supplies memory allocator (lua_open becomes lua_newstate).
  16. + luaopen_* functions must be called through Lua.
  17. Implementation:
  18. + new configuration scheme via luaconf.h.
  19. + incremental garbage collection.
  20. + better handling of end-of-line in the lexer.
  21. + fully reentrant parser (new Lua function `load')
  22. + better support for 64-bit machines.
  23. + native loadlib support for Mac OS X.
  24. + standard distribution in only one library (lualib.a merged into lua.a)
  25. * Changes from version 4.0 to 5.0
  26. -------------------------------
  27. Language:
  28. + lexical scoping.
  29. + Lua coroutines.
  30. + standard libraries now packaged in tables.
  31. + tags replaced by metatables and tag methods replaced by metamethods,
  32. stored in metatables.
  33. + proper tail calls.
  34. + each function can have its own global table, which can be shared.
  35. + new __newindex metamethod, called when we insert a new key into a table.
  36. + new block comments: --[[ ... ]].
  37. + new generic for.
  38. + new weak tables.
  39. + new boolean type.
  40. + new syntax "local function".
  41. + (f()) returns the first value returned by f.
  42. + {f()} fills a table with all values returned by f.
  43. + \n ignored in [[\n .
  44. + fixed and-or priorities.
  45. + more general syntax for function definition (e.g. function a.x.y:f()...end).
  46. + more general syntax for function calls (e.g. (print or write)(9)).
  47. + new functions (time/date, tmpfile, unpack, require, load*, etc.).
  48. API:
  49. + chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer.
  50. + introduced lightweight userdata, a simple "void*" without a metatable.
  51. + new error handling protocol: the core no longer prints error messages;
  52. all errors are reported to the caller on the stack.
  53. + new lua_atpanic for host cleanup.
  54. + new, signal-safe, hook scheme.
  55. Implementation:
  56. + new license: MIT.
  57. + new, faster, register-based virtual machine.
  58. + support for external multithreading and coroutines.
  59. + new and consistent error message format.
  60. + the core no longer needs "stdio.h" for anything (except for a single
  61. use of sprintf to convert numbers to strings).
  62. + lua.c now runs the environment variable LUA_INIT, if present. It can
  63. be "@filename", to run a file, or the chunk itself.
  64. + support for user extensions in lua.c.
  65. sample implementation given for command line editing.
  66. + new dynamic loading library, active by default on several platforms.
  67. + safe garbage-collector metamethods.
  68. + precompiled bytecodes checked for integrity (secure binary dostring).
  69. + strings are fully aligned.
  70. + position capture in string.find.
  71. + read('*l') can read lines with embedded zeros.
  72. * Changes from version 3.2 to 4.0
  73. -------------------------------
  74. Language:
  75. + new "break" and "for" statements (both numerical and for tables).
  76. + uniform treatment of globals: globals are now stored in a Lua table.
  77. + improved error messages.
  78. + no more '$debug': full speed *and* full debug information.
  79. + new read form: read(N) for next N bytes.
  80. + general read patterns now deprecated.
  81. (still available with -DCOMPAT_READPATTERNS.)
  82. + all return values are passed as arguments for the last function
  83. (old semantics still available with -DLUA_COMPAT_ARGRET)
  84. + garbage collection tag methods for tables now deprecated.
  85. + there is now only one tag method for order.
  86. API:
  87. + New API: fully re-entrant, simpler, and more efficient.
  88. + New debug API.
  89. Implementation:
  90. + faster than ever: cleaner virtual machine and new hashing algorithm.
  91. + non-recursive garbage-collector algorithm.
  92. + reduced memory usage for programs with many strings.
  93. + improved treatment for memory allocation errors.
  94. + improved support for 16-bit machines (we hope).
  95. + code now compiles unmodified as both ANSI C and C++.
  96. + numbers in bases other than 10 are converted using strtoul.
  97. + new -f option in Lua to support #! scripts.
  98. + luac can now combine text and binaries.
  99. * Changes from version 3.1 to 3.2
  100. -------------------------------
  101. + redirected all output in Lua's core to _ERRORMESSAGE and _ALERT.
  102. + increased limit on the number of constants and globals per function
  103. (from 2^16 to 2^24).
  104. + debugging info (lua_debug and hooks) moved into lua_state and new API
  105. functions provided to get and set this info.
  106. + new debug lib gives full debugging access within Lua.
  107. + new table functions "foreachi", "sort", "tinsert", "tremove", "getn".
  108. + new io functions "flush", "seek".
  109. * Changes from version 3.0 to 3.1
  110. -------------------------------
  111. + NEW FEATURE: anonymous functions with closures (via "upvalues").
  112. + new syntax:
  113. - local variables in chunks.
  114. - better scope control with DO block END.
  115. - constructors can now be also written: { record-part; list-part }.
  116. - more general syntax for function calls and lvalues, e.g.:
  117. f(x).y=1
  118. o:f(x,y):g(z)
  119. f"string" is sugar for f("string")
  120. + strings may now contain arbitrary binary data (e.g., embedded zeros).
  121. + major code re-organization and clean-up; reduced module interdependecies.
  122. + no arbitrary limits on the total number of constants and globals.
  123. + support for multiple global contexts.
  124. + better syntax error messages.
  125. + new traversal functions "foreach" and "foreachvar".
  126. + the default for numbers is now double.
  127. changing it to use floats or longs is easy.
  128. + complete debug information stored in pre-compiled chunks.
  129. + sample interpreter now prompts user when run interactively, and also
  130. handles control-C interruptions gracefully.
  131. * Changes from version 2.5 to 3.0
  132. -------------------------------
  133. + NEW CONCEPT: "tag methods".
  134. Tag methods replace fallbacks as the meta-mechanism for extending the
  135. semantics of Lua. Whereas fallbacks had a global nature, tag methods
  136. work on objects having the same tag (e.g., groups of tables).
  137. Existing code that uses fallbacks should work without change.
  138. + new, general syntax for constructors {[exp] = exp, ... }.
  139. + support for handling variable number of arguments in functions (varargs).
  140. + support for conditional compilation ($if ... $else ... $end).
  141. + cleaner semantics in API simplifies host code.
  142. + better support for writing libraries (auxlib.h).
  143. + better type checking and error messages in the standard library.
  144. + luac can now also undump.
  145. * Changes from version 2.4 to 2.5
  146. -------------------------------
  147. + io and string libraries are now based on pattern matching;
  148. the old libraries are still available for compatibility
  149. + dofile and dostring can now return values (via return statement)
  150. + better support for 16- and 64-bit machines
  151. + expanded documentation, with more examples
  152. * Changes from version 2.2 to 2.4
  153. -------------------------------
  154. + external compiler creates portable binary files that can be loaded faster
  155. + interface for debugging and profiling
  156. + new "getglobal" fallback
  157. + new functions for handling references to Lua objects
  158. + new functions in standard lib
  159. + only one copy of each string is stored
  160. + expanded documentation, with more examples
  161. * Changes from version 2.1 to 2.2
  162. -------------------------------
  163. + functions now may be declared with any "lvalue" as a name
  164. + garbage collection of functions
  165. + support for pipes
  166. * Changes from version 1.1 to 2.1
  167. -------------------------------
  168. + object-oriented support
  169. + fallbacks
  170. + simplified syntax for tables
  171. + many internal improvements
  172. (end of HISTORY)