require'$'
Requires the minimum amount of modules that every Lua application seems to need and makes a lot of symbols global. 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).
Libraries don’t use this module in an attempt to lower dependency count, avoid polluting the global namespace and improve readability. Apps don’t care about all that and would rather establish a base vocabulary to use everywhere, so they might welcome this module.
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).
Note that the standard Lua module
function is replaced with a function with entirely different semantics.
Anyway, the API
modules |
|
ffi |
require’ffi’ |
bit |
require’bit’ |
glue |
require’glue’ |
pp |
require’pp’ |
math |
|
floor |
math.floor |
ceil |
math.ceil |
min |
math.min |
max |
math.max |
abs |
math.abs |
sqrt |
math.sqrt |
sin |
math.sin |
cos |
math.cos |
tan |
math.tan |
rad |
math.rad |
deg |
math.deg |
random |
math.random |
randomseed |
math.randomseed |
clamp |
glue.clamp |
round |
glue.round |
lerp |
glue.lerp |
arrays |
|
concat |
table.concat |
insert |
table.insert |
remove |
table.remove |
shift |
glue.shift |
add |
table.insert |
push |
table.insert |
pop |
table.remove |
del |
table.remove |
append |
glue.append |
extend |
glue.extend |
sort |
table.sort |
indexof |
glue.indexof |
map |
glue.map |
pack |
glue.pack |
unpack |
glue.unpack |
tables |
|
update |
glue.update |
merge |
glue.merge |
attr |
glue.attr |
count |
glue.count |
index |
glue.index |
keys |
glue.keys |
sortedpairs |
glue.sortedpairs |
map |
glue.map |
strings |
|
format |
string.format |
_ |
string.format |
rep |
string.rep |
char |
string.char |
esc |
glue.esc |
subst |
glue.subst |
s:starts |
glue.starts |
s:ends |
glue.ends |
s:trim |
glue.trim |
s:lines |
glue.lines |
s:esc |
glue.esc |
s:fromhex |
glue.fromhex |
s:tohex |
glue.tohex |
s:subst |
glue.subst |
coroutines |
|
cocreate |
coroutine.create |
cowrap |
coroutine.wrap |
resume |
coroutine.resume |
yield |
coroutine.yield |
stubs |
|
noop |
glue.noop |
pass |
glue.pass |
caching |
|
memoize |
glue.memoize |
errors |
|
assertf |
glue.assert |
bit |
|
bnot |
bit.bnot |
shl |
bit.lshift |
shr |
bit.rshift |
band |
bit.band |
bor |
bit.bor |
xor |
bit.bxor |
ffi |
|
C |
ffi.C |
cast |
ffi.cast |
Windows |
ffi.os == ‘Windows’ |
Linux |
ffi.os == ‘Linux’ |
OSX |
ffi.os == ‘OSX’ |
BSD |
ffi.os == ‘BSD’ |
POSIX |
ffi.os == ‘POSIX’ |
win |
Windows |
addr |
glue.addr |
ptr |
glue.ptr |
modules |
|
module |
glue.module |
autoload |
glue.autoload |
objects |
|
inherit |
glue.inherit |
object |
glue.object |
before |
glue.before |
after |
glue.after |
override |
glue.override |
debugging |
|
traceback |
debug.traceback |
date/time |
|
date |
os.date |
time |
glue.time |
day |
glue.day |
month |
glue.month |
year |
glue.year |
clock |
time.clock |
sleep |
time.sleep |
file i/o |
|
canopen |
glue.canopen |
readfile |
glue.readfile |
writefile |
glue.writefile |
exec |
|
readpipe |
glue.readpipe |
termination |
|
exit |
os.exit |
Last updated:
27 days ago
|
Edit on GitHub