mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2024-08-20 05:04:09 +02:00
refactor tbl2number
This commit is contained in:
parent
a08ab4f93d
commit
332517912d
13
md5.lua
13
md5.lua
@ -56,16 +56,13 @@ if ok then
|
||||
else
|
||||
|
||||
local function tbl2number(tbl)
|
||||
local n = #tbl
|
||||
|
||||
local rslt = 0
|
||||
local result = 0
|
||||
local power = 1
|
||||
for i = 1, n do
|
||||
rslt = rslt + tbl[i]*power
|
||||
power = power*2
|
||||
for i = 1, #tbl do
|
||||
result = result + tbl[i] * power
|
||||
power = power * 2
|
||||
end
|
||||
|
||||
return rslt
|
||||
return result
|
||||
end
|
||||
|
||||
local function expand(t1, t2)
|
||||
|
Loading…
Reference in New Issue
Block a user