Home Download Buy Blog Forum Support

Corrections to Lua scoping

Corrections to Lua scoping

Postby Neffi on Tue Jan 07, 2014 8:21 am

I recently started using ST3 primarily for Lua work, and I found a few corrections that need to be made in the Lua package included with ST3.

  • The constants provided by the language _G, _VERSION, math.pi and math.huge ought not to be categorized in constant.language.lua. They don't make sense being colored the same as true/false/nil. In my own corrected version of the Lua package, I placed these under support.constant.lua, since they're variables provided by the base libraries.
  • ST3's Lua package also doesn't recognize the other constants provided by the base libraries: io.stderr, io.stdin, io.stdout, package.loaders, package.config. These belong in the same place as the above. (package.loaders was renamed package.searchers in 5.2, so possibly both should be included; 5.1 is still popular).
  • It is also missing a few library functions from support.function.lua, namely: load, newproxy, rawlen, table.pack, table.unpack, package.searchpath.

I've made these corrections in my own local package for Lua, but there's also one other correction that needs to be made, and I don't understand regex well enough to do it. All functions in the standard library "string" and some from the standard library "io" can also be called in the form var:func(), eg ("mystring%d"):format(1) or file:write("hello"). So this specific subset of functions should be scoped such that they are preceded by a colon.

The functions are
  • string: byte char dump find format gmatch gsub len lower match rep reverse sub upper
  • io: close flush lines read seek setvbuf write
Neffi
 
Posts: 1
Joined: Tue Jan 07, 2014 7:58 am

Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests