From 1e3017b4f6ad295de8f471f54866e38ecd551877 Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Fri, 6 Aug 2021 18:21:08 -0500 Subject: [PATCH] Updated localization files --- .vscode/settings.json | 6 ++++++ rng.lua | 13 ++++++------- tools.lua | 12 ++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..45e34fe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "Lua.diagnostics.globals": [ + "messagepart2", + "messagePart2" + ] +} \ No newline at end of file diff --git a/rng.lua b/rng.lua index 1a604b6..5d33bff 100644 --- a/rng.lua +++ b/rng.lua @@ -3,17 +3,16 @@ local tools = require("./tools.lua") function rng.d20() tools.reseed() - dice = math.random(20) - messagePart1 = ('You rolled a ' .. dice .. ' out of 20') + local dice = math.random(20) + local messagePart1 = ('You rolled a ' .. dice .. ' out of 20') + messagepart2 = "" if dice==20 then - messagePart2 = ('Nat 20! Crititcal Hit') + messagePart2 = ('Nat 20! Crititcal Hit') else if dice==1 then - messagePart2 = ('Nat 1! Critical Shit!') - else - messagePart2 = "" + messagePart2 = ('Nat 1! Critical Shit!') end end - message = messagePart1 .. '\n' .. messagePart2 + local message = messagePart1 .. '\n' .. messagePart2 return message end diff --git a/tools.lua b/tools.lua index bab73ff..304959b 100644 --- a/tools.lua +++ b/tools.lua @@ -2,21 +2,21 @@ local tools = {} function tools.reseed() - seed = os.time() + local seed = os.time() math.randomseed(seed) end function tools.printFile(file) - rawFile = io.open(file, r) - message = rawFile:read("*all") + local rawFile = io.open(file, r) + local message = rawFile:read("*all") rawFile:close() return message end function tools.messageDectection(message, search) - distinctMessage = message.content - key = "!" - keyedSearch = key .. search + local distinctMessage = message.content + local key = "!" + local keyedSearch = key .. search if string.find(distinctMessage, keyedSearch) == 1 then return true else