From d4ecdae66af8c6b4df66b79017de0b5d04053ef4 Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Wed, 11 Aug 2021 19:13:12 -0500 Subject: [PATCH] Changes to mode.lua, namely it is no longer mode.lua simply mode, as it has no need to be a lua file. --- .gitignore | 3 ++- API/tools.lua | 20 ++++++++++++-------- docs/mode.lua | 2 -- 3 files changed, 14 insertions(+), 11 deletions(-) delete mode 100644 docs/mode.lua diff --git a/.gitignore b/.gitignore index 7657b7e..cd315f1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ docs/reinitialize.lua docs/mode.lua docs/reinitialize.lua docs/key.lua -docs/token.lua \ No newline at end of file +docs/token.lua +docs/mode diff --git a/API/tools.lua b/API/tools.lua index d40f2a7..672f11e 100644 --- a/API/tools.lua +++ b/API/tools.lua @@ -34,12 +34,12 @@ function tools.initialize() end end ---Sets mode.lua +--Sets mode function tools.setMode(mode) - local file = io.open("./docs/mode.lua", "r+") + local file = io.open("./docs/mode", "r+") io.input(file) io.output(file) - file:seek("set", 7) + file:seek("set", 0) if mode == "test" then file:write("'test' ") elseif mode == "normal" then @@ -52,14 +52,18 @@ function tools.setMode(mode) end function tools.getMode() - local file = io.open("./docs/mode.lua", "r") + local file = io.open("./docs/mode", "r+") io.input(file) - file:seek("set", 7) + file:seek("set", 0) local mode = file:read() file:close() - mode = mode:gsub("%s+", "") - mode = mode:gsub("'", "") - return mode + if mode then + mode = mode:gsub("%s+", "") + mode = mode:gsub("'", "") + return mode + else + return "normal" + end end --Sets if we should reinitialize. diff --git a/docs/mode.lua b/docs/mode.lua deleted file mode 100644 index da80feb..0000000 --- a/docs/mode.lua +++ /dev/null @@ -1,2 +0,0 @@ -return 'normal' ---normal or test \ No newline at end of file