lsyncd/mantle/userenv.lua

78 lines
1.6 KiB
Lua
Raw Permalink Normal View History

2018-03-30 13:15:49 +00:00
--
-- userenv.lua from Lsyncd -- the Live (Mirror) Syncing Demon
2018-03-15 12:43:02 +00:00
--
--
-- Setups up the global environment for a user script.
--
2018-03-23 16:36:51 +00:00
-- The default sync implementations will add the 'default' global
-- to this. They are loaded in user context, so they can simply set it.
--
2018-03-15 12:43:02 +00:00
--
-- License: GPLv2 (see COPYING) or any later version
-- Authors: Axel Kittenberger <axkibe@gmail.com>
--
2018-05-13 12:13:54 +00:00
userenv =
2018-03-15 16:11:45 +00:00
{
-- generic lua stuff to be available
_VERSION = _VERSION,
assert = assert,
bit32 = bit32,
coroutine = coroutine,
dofile = dofile,
error = error,
getmetatable = getmetable,
2018-05-12 13:08:14 +00:00
getsignal = getsignal,
2018-03-15 16:11:45 +00:00
io = io,
ipairs = ipairs,
load = load,
loadfile = loadfile,
loadstring = loadstring,
math = math,
module = module,
next = next,
2018-05-12 13:08:14 +00:00
onsignal = onsignal,
2018-03-15 16:11:45 +00:00
os = os,
package = package,
pairs = pairs,
pcall = pcall,
print = print,
rawequal = rawequal,
rawlen = rawlen,
rawget = rawget,
rawset = rawset,
require = require,
select = select,
setmetatable = setmetatable,
2018-06-04 06:54:06 +00:00
signum = signum,
2018-03-15 16:11:45 +00:00
string = string,
table = table,
type = type,
unpack = unpack,
2018-03-15 12:43:02 +00:00
2018-03-15 16:11:45 +00:00
-- lsyncd mantle available to user scripts
Array = Array,
Queue = Queue,
2018-05-13 12:13:54 +00:00
-- user interface functions and objects
alarm = user.alarm,
nonobservefs = user.nonobserfd,
observefd = user.observefd,
settings = user.settings,
2018-06-04 06:54:06 +00:00
signal = signal,
2018-06-06 07:24:13 +00:00
softreset = user.softreset,
2018-05-13 12:13:54 +00:00
spawn = user.spawn,
spawnShell = user.spawnShell,
sync = user.sync,
syncs = user.syncs,
2018-03-15 12:43:02 +00:00
2018-03-15 16:11:45 +00:00
-- lsyncd core available to user scripts
2018-05-13 12:13:54 +00:00
-- FIXME always make wrappers
2018-03-19 08:02:30 +00:00
log = core.log,
2018-03-15 16:11:45 +00:00
now = core.now,
readdir = core.readdir,
terminate = core.terminate
}
2018-03-15 12:43:02 +00:00
2018-05-13 12:13:54 +00:00
userenv._G = userenv
2018-03-15 12:43:02 +00:00