• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 7: Line 7:  
-- I fucking hate lua.
 
-- I fucking hate lua.
   −
 
+
-- Takes a table. Returns a bool of whether it's empty or not.
 +
function table.empty (self)
 +
    for _, _ in pairs(self) do
 +
        return false
 +
    end
 +
    return true
 +
end
    
-- takes a string and returns string with first letter capitalized
 
-- takes a string and returns string with first letter capitalized
Line 30: Line 36:  
 
 
if seed == nil then
 
if seed == nil then
 +
mw.log("asdf")
 
randomizer = math.random(0,9999999)
 
randomizer = math.random(0,9999999)
 
elseif type(seed) == "table" then
 
elseif type(seed) == "table" then
-- for k,v in pairs(seed) do
+
if table.empty(seed) then
-- randomizer = randomizer + p.hashString(k)
+
randomizer = math.random(0,9999999)
-- if type(v) == "string" then
+
else
-- randomizer = randomizer + p.hashString(v)
+
mw.log("fdsa")
-- end
+
for k,v in pairs(seed) do
-- if type(v) == "number" then
+
randomizer = randomizer + p.hashString(k)
-- randomizer = randomizer + v
+
if type(v) == "string" then
-- end
+
randomizer = randomizer + p.hashString(v)
-- end
+
end
 +
if type(v) == "number" then
 +
randomizer = randomizer + v
 +
end
 +
end
 +
end
 
elseif type(seed) == "string" then
 
elseif type(seed) == "string" then
 
randomizer = p.hashString(seed)
 
randomizer = p.hashString(seed)
Line 48: Line 60:  
local time = os.time()
 
local time = os.time()
 
local rand = math.random(-1,1)
 
local rand = math.random(-1,1)
return (math.floor(time*265314426625821*rand*randomizer)-randomizer) % 2^32+math.floor(math.random(-1,1)*1381242451)
+
mw.log(randomizer)
 +
mw.log(rand)
 +
mw.log(time)
 +
mw.log("fdsa")
 +
return (math.floor(time*265314426625821*rand)-randomizer) % 2^32+math.floor(math.random(-1,1)*1381242451)
 
end
 
end
  
2,922

edits

Navigation menu