From 11f9866dbe951652b14c1edd85547b870d0a0c2f Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Mon, 13 Dec 2021 11:22:58 -0500 Subject: [PATCH] Enable more of the IO library in Lua sandbox Also changes the Lua warning color to red. --- aiserver.py | 2 +- bridge.lua | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aiserver.py b/aiserver.py index c5e02610..86172d66 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1018,7 +1018,7 @@ def lua_warn(msg): if(vars.lua_logname != vars.lua_koboldbridge.logging_name): vars.lua_logname = vars.lua_koboldbridge.logging_name print(colors.BLUE + lua_log_format_name(vars.lua_logname) + ":" + colors.END, file=sys.stderr) - print(colors.YELLOW + msg.replace("\033", "") + colors.END) + print(colors.RED + msg.replace("\033", "") + colors.END) #==================================================================# # Decode tokens into a string using current tokenizer diff --git a/bridge.lua b/bridge.lua index 6db07cb9..e5d407bc 100644 --- a/bridge.lua +++ b/bridge.lua @@ -1509,6 +1509,11 @@ return function(_python, _bridged) ult = math.ult, }, io = { + stdin = io.stdin, + stdout = io.stdout, + stderr = io.stderr, + input = io.input, + output = io.output, read = io.read, write = io.write, flush = io.flush,