User Tools

Site Tools


lgscript:lua

Lua Language Reference

The language implemented by LgScript is mostly the same as standard Lua. The differences are:

  • Symbol-literal syntax. Where a name is expected, a [ string ] can appear where the value of the string is the symbol name.
    i.e. local ["A variable"] = 9 assigns a number to the variable named ”A variable”.
  • Hexadecimal character codes in strings (Backport from 5.2).
  • Metatable methods __pairs, __ipairs, and __len (Backport from 5.2).
  • Recognize @rem as magic for turning a Lua script into a BAT file.
  • Remove the deprecated functions math.mod, string.gfind and table.setn.
  • Millisecond resolution for os.time.

And includes bundled modules for the following features:

  • Finalizer functions fcall, finalize, finally, onreturn, onerror.
  • Add function seq. Returns a sequence of numbers. Takes one, two, or three numeric parameters.
  • Add function shift and change the behavior of select. For any list of values A and any integer N, shift(N,A) will return the first N values and select(N+1,A) will return the remaining values.
  • Vector type. Adds library function vector and methods vector.mag, vector.norm, vector.dot, vector.cross, vector.new.
  • Table library functions extend, merge, reverse, pack, find, keys, values.
  • Math library function round.
  • Bit32 library backported from 5.2.
  • Custom character set that matches the typical Dark Engine fonts.

When running in the game, the io and os libraries are disabled for security.

Table of Contents

lgscript/lua.txt · Last modified: 2011/05/20 21:23 by telliamed