Lua 5.5 programming language is available

After five years of development, Lua 5.5 is now available. Lua is a fast and compact scripting language widely used as an embedded language for configuration and extension development. The Lua interpreter is written in C and licensed under the MIT license.

Lua combines a simple procedural syntax with data description capabilities through associative arrays and extensible language semantics. Lua uses dynamic typing, and language constructs are converted into bytecode that runs on a register-based virtual machine with automatic garbage collection. The interpreter is implemented as a library that can be integrated into C and C++ projects.

Main innovations:

  • Most garbage collection operations use incremental mode, which breaks the garbage collection cycle into separate steps interspersed with program execution, eliminating long pauses in the execution of applications with a large number of objects in memory.
  • A compact implementation of arrays is proposed that requires 60% less memory for arrays with the same type of data (the savings are achieved due to the fact that the type data is stored not for each element, but for a group of elements).
  • The ability to explicitly declare global variables in any code block using the "global" keyword has been added. When specifying expressions with the "global" keyword in a code block, all variables must be explicitly declared. If the "global" declaration is missing, the "global *" expression is implicitly set, which preserves the old behavior and treats all variables as global. The "global" expression has also been added. *" in which all implicitly defined global variables become read-only. X = 1 — Ok, X is a global variable, the old default behavior. do global Y — declares variable Y as global, all other variables in the block must be declared explicitly. Y = 1 — Ok, variable Y is previously defined. X = 1 — Error, variable X is not defined. end X = 2 — Ok, outside the global block, the old behavior applies.
  • Control variables specified in "for" loops are now read-only and cannot be modified within the loop body. For example, the variable i declared in the "for i = 1, 5 do" loop cannot be modified within the loop body.
  • When printing floating point numbers using the print function, a sufficient number of digits are now printed to correctly convert them back from a string to their original representation.
  • The allowed number of nesting levels for table constructors has been increased.
  • Added table.create(nseq, nrec) function to add an empty table and pre-allocate memory for the specified number of elements.
  • The utf8.offset function returns not only the byte offset to the beginning of the character, but also the position of the end of the character.
  • Added support for creating external strings that reside in memory not managed by the Lua garbage collector.
  • Added luaL_openselectedlibs function for loading the selected library, as well as luaL_makeseed function, which forms a seed for the lua_newstate function.
  • In lua.c, dynamic loading of the 'readline' library is ensured if it is available (if the library is present in the system, it is loaded and line editing functions become available).
  • Enabled optimization to save memory when loading precompiled bytecode - Lua can now reuse memory in some internal structures without creating duplicates when loading duplicate bytecode.
  • Ensured that all rows are reused in the dump and undump operations.
  • In auxiliary buffers, buffer reuse (without copying to a new buffer) is ensured when creating the final string.

Source: opennet.ru

Buy reliable hosting for sites with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster