1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
local function lib_load(path, name)
if not _G[name] then
os.loadAPI(fs.combine(path, "lib/" .. name .. ".lua"))
if not _G[name] then _G[name] = _G[name .. ".lua"] end
end
end
return {
description = "Replaces the Lua REPL with an advanced version.",
dependencies = {
"bin/lua.lua",
"lib/stack_trace.lua"
},
-- When updating the defaults, one should also update bin/lua.lua
settings = {
{
name = "mbs.lua.enabled",
description = "Whether the extended Lua REPL is enabled.",
default = true,
},
{
name = "mbs.lua.history_file",
description = "The file to save history to. Set to false to disable.",
default = ".lua_history",
},
{
name = "mbs.lua.history_max",
description = "The maximum size of the history file",
default = 1e4,
},
{
name = "mbs.lua.traceback",
description = "Show an error traceback when an input errors",
default = true,
},
{
name= "mbs.lua.pretty_height",
description = "The height to fit the pretty-printer output to. Set to "
.. "false to disable, true to use the terminal height or a number for a constant height.",
default = true,
},
{
name= "mbs.lua.highlight",
description = "Whether to apply syntax highlighting to the REPL's input.",
default = true,
},
},
enabled = function() return settings.get("mbs.lua.enabled") end,
setup = function(path)
lib_load(path, "stack_trace")
shell.setAlias("lua", "/" .. fs.combine(path, "bin/lua.lua"))
end
}
|