lights FAQ Forum github.com/luapower/dollar
This package
$
$daemon
$fs
$log

Standard Libraries
glue
pp
oo
events
coro
errors
lpeg
dollar

$

"Seriously, there's no need for all that qualifying of everything" - Fartman


require'$'

Loads the minimum amount of modules that every Lua application seems to need and makes a lot of symbols global. Think of it as emptying all your tool boxes on the floor before you start a job. Some people feel more efficient doing it like that, others hate it, wacha gonna do.

Libraries don’t use this module in an attempt to lower dependency count, avoid polluting the global namespace and improve code readability. Apps don’t care about all that and would rather establish a base vocabulary to use everywhere, so this module can be useful when building an app, less so when making a library.

What libraries usually do instead of loading this module:

  • require the ffi module every goddamn time (and maybe the bit module).
  • copy-paste a few tools from glue to avoid bringing in the whole kitchen.
  • put used symbols into locals (also for speed when code is interpreted).

All that is wasted effort on an app, where you already established your dependencies so anyone who wants to work on your code needs to be familiar with them dependencies beforehand.

Note that the standard Lua module function is replaced with a function with entirely different semantics (see glue for that).

TIP: Run the script standalone with luajit $.lua to get a listing of all the symbols (which you can then paste into your editor config file for syntax highlighting).


Last updated: 28 days ago | Edit on GitHub

Package:dollar
Pkg type:Lua+ffi
Version: 90b5da6
Last commit:
License: Public Domain

Requires: glue  luajit  pp  time 

Required by: none


Top