Operating system for OpenComputers
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

shell.lua 535B

1234567891011121314151617
  1. print(pcall(function()
  2. local shenv = {}
  3. function shenv.quit()
  4. os.setenv("run",nil)
  5. end
  6. setmetatable(shenv,{__index=function(_,k) if _G[k] then return _G[k] elseif fs.exists("/boot/exec/"..k..".lua") then return loadfile("/boot/exec/"..k..".lua") end end})
  7. print(_VERSION)
  8. os.setenv("run",true)
  9. while os.getenv("run") do
  10. io.write((os.getenv("PWD") or _VERSION).."> ")
  11. tResult = {pcall(load(io.read(),"shell","t",shenv))}
  12. if tResult[1] == true then table.remove(tResult,1) end
  13. for k,v in pairs(tResult) do
  14. print(v)
  15. end
  16. end
  17. end))