testing stuff

This commit is contained in:
AFCMS 2021-06-24 23:58:17 +02:00
parent cc0ed855a9
commit a6e0605b7c
1 changed files with 15 additions and 4 deletions

View File

@ -90,8 +90,10 @@ mcl_commands.types = {
}, },
} }
function mcl_commands.match_param(string, type, params) function mcl_commands.match_param(table, index, type, params)
local typedef = mcl_commands.types[type]
local params = {}
typedef.func()
end end
mcl_commands.registered_commands = {} mcl_commands.registered_commands = {}
@ -103,8 +105,17 @@ end
function mcl_commands.register_basic_command(name, def) function mcl_commands.register_basic_command(name, def)
local func local func
if def.params then if def.params then
local funcparams = "" func = function(name, param)
return local funcparams = {}
local i = 0
for str in string.gmatch(params, "([^ ]+)") do
i = i + 1
funcparams[i] = str
end
for _,type in pairs(def.params) do
mcl_commands.match_param(funcparams, index, type, params)
end
end
else else
mcl_commands.registered_commands[name] = {type = "basic", description = def.desc, privs = def.privs} mcl_commands.registered_commands[name] = {type = "basic", description = def.desc, privs = def.privs}
func = function(name, param) func = function(name, param)