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