chore: cleanup and remove extra spaces

pull/61/head
sammyette 2021-06-09 18:41:37 -04:00
parent ce5ac86a4c
commit 14064eceda
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 9 additions and 9 deletions

View File

@ -44,19 +44,19 @@ end)
do do
local virt_G = { } local virt_G = { }
setmetatable(_G, { setmetatable(_G, {
__index = function (self, key) __index = function (_, key)
local got_virt = virt_G[key] local got_virt = virt_G[key]
if got_virt ~= nil then if got_virt ~= nil then
return got_virt return got_virt
end end
virt_G[key] = os.getenv(key) virt_G[key] = os.getenv(key)
return virt_G[key] return virt_G[key]
end, end,
__newindex = function (self, key, value) __newindex = function (_, key, value)
if type(value) == 'string' then if type(value) == 'string' then
os.setenv(key, value) os.setenv(key, value)
virt_G[key] = value virt_G[key] = value
@ -68,7 +68,7 @@ do
end end
end, end,
}) })
bait.catch('command.exit', function () bait.catch('command.exit', function ()
for key, value in pairs(virt_G) do for key, value in pairs(virt_G) do
if type(value) == 'string' then if type(value) == 'string' then
@ -82,15 +82,15 @@ end
function string.split(str, delimiter) function string.split(str, delimiter)
local result = {} local result = {}
local from = 1 local from = 1
local delim_from, delim_to = string.find(str, delimiter, from) local delim_from, delim_to = string.find(str, delimiter, from)
while delim_from do while delim_from do
table.insert(result, string.sub(str, from, delim_from - 1)) table.insert(result, string.sub(str, from, delim_from - 1))
from = delim_to + 1 from = delim_to + 1
delim_from, delim_to = string.find(str, delimiter, from) delim_from, delim_to = string.find(str, delimiter, from)
end end
table.insert(result, string.sub(str, from)) table.insert(result, string.sub(str, from))
return result return result