Skip to main content

Lua Reference

Use Lua 5.4 version, and some features have been customized.

Features

  • Allow UniCode variable names
  • Where integers are required, take floor for floating point numbers instead of reporting exceptions
  • Compatible with 5.3
  • Use 32-bit integers and 32-bit floats
#define LUA_UCID 1
#define LUA_FLOORN2I F2Ifloor
#define LUA_COMPAT_5_3

#define LUA_32BITS 1

Lexical Patch

Support binary number format, numbers starting with 0B/0b are regarded as binary: 0bxxxx / 0Bxxxx

Example:

a=0b1101.101
b=0B11001100

Character Escape Patch

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

Adjust Lua Library And Function

Supported Lua Libraries:

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

Disable load/loadstring

Added Lua Library

  • cjson
  • cjson_safe

Added Function

  • compress : zlib compression function

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

  • decompress : zlib decompression function

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

  • md5sum(str) : calculate md5 and return 16-byte binary data

  • md5sumhexa(str) : calculate md5 and return the result in hex format, lowercase