mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-12 00:50:05 +00:00
Make Lua's "exit" function a little prettier
"exit" now has a custom __tostring method, which prints an explanation message. This is very similar to how Python achives the same functionality: lua> exit Call exit() to exit lua> exit() > Actually leaves the REPL
This commit is contained in:
parent
041cfe91b4
commit
42f5389fb8
@ -9,9 +9,10 @@ end
|
||||
local bRunning = true
|
||||
local tCommandHistory = {}
|
||||
local tEnv = {
|
||||
["exit"] = function()
|
||||
bRunning = false
|
||||
end,
|
||||
["exit"] = setmetatable({}, {
|
||||
__tostring = function() return "Call exit() to exit" end,
|
||||
__call = function() bRunning = false end,
|
||||
}),
|
||||
["_echo"] = function( ... )
|
||||
return ...
|
||||
end,
|
||||
|
Loading…
x
Reference in New Issue
Block a user