feat: meilleur gestion des listes

This commit is contained in:
Kazhnuz 2024-08-02 08:53:17 +02:00
parent df05425b8a
commit e9d05ebd30
3 changed files with 9 additions and 4 deletions

View file

@ -16,7 +16,10 @@ function RawData.fromLine(line)
name = utils.trim(datas[1]) name = utils.trim(datas[1])
for i, v in ipairs(datas) do for i, v in ipairs(datas) do
if (i > 1) then if (i > 1) then
table.insert(args, utils.trim(v)) local str = utils.trim(v)
if ((str ~= nil and str ~= "") or i < #datas) then
table.insert(args, str)
end
end end
end end
local level = 0 local level = 0

View file

@ -47,9 +47,10 @@ function functions.clean(args, command)
if (baseCommand == nil) then if (baseCommand == nil) then
error("Command " .. baseCommand .. " doesn't exists") error("Command " .. baseCommand .. " doesn't exists")
end end
if (baseCommand.args == nil or baseCommand.args == 1) then local commandData = struct[baseCommand]
if (commandData.args == nil or commandData.args == 1) then
local arg = args[1] local arg = args[1]
if (baseCommand.contentType == "number") then if (commandData.contentType == "number") then
arg = tonumber(arg) arg = tonumber(arg)
end end
return arg return arg

View file

@ -18,6 +18,7 @@ return {
armurepsy= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0}, armurepsy= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0},
armurespe= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0}, armurespe= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0},
armes= {dataType= "list", args=2}, armes= {dataType= "list", args=2},
competence= {dataType= "comp"}, -- on va le gérer différemment comme du code lol sinon c'est trop relou competence= {dataType= "comp", args=3}, -- on va le gérer différemment comme du code lol sinon c'est trop relou
skill= {dataType= "list", args=2}, -- on va le gérer différemment comme du code lol sinon c'est trop relou
armes= {dataType= "list", args=1}, armes= {dataType= "list", args=1},
} }