Fix for top scripts: the code was not discarding non .lua files

This commit is contained in:
Luca Deri 2015-08-15 12:19:06 +02:00
parent 5f7d8ae2ec
commit 83fe0afb99
4 changed files with 172 additions and 163 deletions

View file

@ -1606,16 +1606,18 @@ function makeTopStatsScriptsArray()
topArray = {}
for k,v in pairs(files) do
if(v ~= nil) then
value = {}
fn,ext = v:match("([^.]+).([^.]+)")
mod = require("top_scripts."..fn)
if(type(mod) ~= type(true)) then
value["name"] = mod.name
value["script"] = mod.infoScript
value["key"] = mod.infoScriptKey
value["levels"] = mod.numLevels
topArray[fn] = value
if(string.ends(k, ".lua")) then
if(v ~= nil) then
value = {}
fn,ext = v:match("([^.]+).([^.]+)")
mod = require("top_scripts."..fn)
if(type(mod) ~= type(true)) then
value["name"] = mod.name
value["script"] = mod.infoScript
value["key"] = mod.infoScriptKey
value["levels"] = mod.numLevels
topArray[fn] = value
end
end
end
end