Lua5.3 released 变化



待总结

主要变化

  • 整数 (默认 64 位)
  • 32 位整数的官方支持
  • 位操作符
  • 基本的 utf-8 支持
  • 值的打包及解包函数
这些是 Lua 5.3 引入的其它变更:

语言

  • 用户数据可以是任意 Lua 值
  • 整数除法
  • 某些元方法有了更加灵活的规则

  • ipairs 以及表处理库都会考虑元方法
  • string.dump 多了裁减选项
  • 表处理库考虑了元方法
  • 新函数 table.move
  • 新函数 string.pack
  • 新函数 string.unpack
  • 新函数 string.packsize

C API

  • 简化了延续点 API
  • lua_gettable 以及类似函数会返回结果的值类型
  • lua_dump 增加了裁减选项
  • 新函数: lua_geti
  • 新函数: lua_seti
  • 新函数: lua_isyieldable
  • 新函数: lua_numbertointeger
  • 新函数: lua_rotate
  • 新函数: lua_stringtonumber

Lua 独立解释器

  • 可以做计算器使用;不再需要前置 '='
  • arg 表对所有代码都可用


Main changes

  • integers (64-bit by default)
  • official support for 32-bit numbers
  • bitwise operators
  • basic utf-8 support
  • functions for packing and unpacking values
Here are the other changes introduced in Lua 5.3:

Language

  • userdata can have any Lua value as uservalue
  • integer division
  • more flexible rules for some metamethods

Libraries

  • ipairs and the table library respect metamethods
  • strip option in string.dump
  • table library respects metamethods
  • new function table.move
  • new function string.pack
  • new function string.unpack
  • new function string.packsize

C API

  • simpler API for continuation functions in C
  • lua_gettable and similar functions return type of resulted value
  • strip option in lua_dump
  • new function: lua_geti
  • new function: lua_seti
  • new function: lua_isyieldable
  • new function: lua_numbertointeger
  • new function: lua_rotate
  • new function: lua_stringtonumber

Lua standalone interpreter

  • can be used as calculator; no need to prefix with '='
  • arg table available to all code

你可能感兴趣的:(Lua5.3 released 变化)