aboutsummaryrefslogtreecommitdiff
path: root/.mbs/modules/lua.lua
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@gmail.com>2019-07-19 14:10:39 -0400
committerAndrew Lee <alee14498@gmail.com>2019-07-19 14:10:39 -0400
commitfe08446d84e0aa939780ad013f0545778703da6d (patch)
treef45358ae6470dc894c41abcb278c4898c7ef1b18 /.mbs/modules/lua.lua
parent21446806b264d8fd6694b1495f0c51bf24d26b35 (diff)
downloadbits-UI-fe08446d84e0aa939780ad013f0545778703da6d.tar.gz
bits-UI-fe08446d84e0aa939780ad013f0545778703da6d.tar.bz2
bits-UI-fe08446d84e0aa939780ad013f0545778703da6d.zip
MBS as default shell
Diffstat (limited to '.mbs/modules/lua.lua')
-rw-r--r--.mbs/modules/lua.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/.mbs/modules/lua.lua b/.mbs/modules/lua.lua
new file mode 100644
index 0000000..d9453e6
--- /dev/null
+++ b/.mbs/modules/lua.lua
@@ -0,0 +1,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
+} \ No newline at end of file