跳到主要内容

Lua 说明

使用 Lua 5.4版本, 并对特性进行了部分定制

特性定义

  • 允许使用UniCode变量名
  • 在需要整数的地方, 对浮点数取floor, 而不是报异常
  • 兼容5.3
  • 使用32位整数和32位浮点数
#define LUA_UCID 1
#define LUA_FLOORN2I F2Ifloor
#define LUA_COMPAT_5_3

#define LUA_32BITS 1

词法补丁

支持2进制数字格式,0B/0b开头的数字认为2进制 : 0bxxxx / 0Bxxxx

例如:

a=0b1101.101
b=0B11001100

字符串转义符补丁

  \* : \1
\# : \2
\- : \3
\| : \4
\+ : \5
\^ : \6

调整Lua库和函数

支持的Lua库:

  • coroutine
  • table
  • string
  • math
  • utf8
  • debug

禁用load/loadstring

增加的Lua库

  • cjson
  • cjson_safe

增加的函数

  • compress : zlib压缩函数

    zstr=compress(str,from,to,compresslvl[,method,windowBits,memlvl,strategy,dict])

  • decompress : zlib解压缩函数

    str=decompress(zstr,from,to[, windowBits,dict])

  • md5sum(str) : 计算md5, 返回16字节2进制数据

  • md5sumhexa(str) : 计算md5,返回hex格式的结果, 小写