diff --git a/assets/opencomputers/lua/rom/bin/lua.lua b/assets/opencomputers/lua/rom/bin/lua.lua index b4868706d..213308a37 100644 --- a/assets/opencomputers/lua/rom/bin/lua.lua +++ b/assets/opencomputers/lua/rom/bin/lua.lua @@ -1,13 +1,15 @@ -while term.isAvailable() do +print("Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio") +local running = true +local env = setmetatable({exit=function() running = false end}, {__index=_ENV}) +while running and term.isAvailable() do io.write("lua> ") local command = io.read() if not command then return -- eof end - - local code, result = load("return " .. command, "=stdin") + local code, result = load("return " .. command, "=stdin", env) if not code then - code, result = load(command, "=stdin") -- maybe it's a statement + code, result = load(command, "=stdin", env) -- maybe it's a statement end if code then local result = table.pack(pcall(code))