fix reload, new valute
This commit is contained in:
parent
70da2d717e
commit
08788c827e
3 changed files with 23 additions and 7 deletions
|
@ -7,6 +7,7 @@ return {
|
|||
end
|
||||
|
||||
local path = 'src.'..cat..'.'..sub
|
||||
C.api:off(package.loaded[path])
|
||||
package.loaded[path] = nil
|
||||
local err, m = pcall(require, path)
|
||||
|
||||
|
|
|
@ -23,6 +23,15 @@ function rub:course(wants)
|
|||
Name = 'Российский рубль',
|
||||
Value = '1'
|
||||
})
|
||||
local uah = table.findV(resp.Valute, {CharCode = 'UAH'})
|
||||
table.insert(resp.Valute, {
|
||||
ID = 'R02000',
|
||||
NumCode = '200',
|
||||
CharCode = 'SHT',
|
||||
Nominal = 1,
|
||||
Name = 'Штаны',
|
||||
Value = ('%f'):format(tonumber(uah.Value:gsub(',', '.'), nil) / uah.Nominal * 40)
|
||||
})
|
||||
|
||||
wants = type(wants) == 'table' and wants or {}
|
||||
local r, founds = {}, {}
|
||||
|
|
|
@ -5,14 +5,20 @@
|
|||
end
|
||||
|
||||
function table.find(t, w)
|
||||
local i
|
||||
for k,v in pairs(t) do
|
||||
if v == w then
|
||||
i = k
|
||||
break
|
||||
for _,v in pairs(t) do
|
||||
if v == w then return v end
|
||||
end
|
||||
end
|
||||
|
||||
function table.findV(t, w)
|
||||
local b
|
||||
for _,v in pairs(t) do
|
||||
for k,x in pairs(w) do
|
||||
if x ~= v[k] then b=1; break end
|
||||
end
|
||||
if b then b = nil
|
||||
else return v end
|
||||
end
|
||||
return i
|
||||
end
|
||||
|
||||
function dump(t, d)
|
||||
|
|
Loading…
Reference in a new issue