add some type definitions

This commit is contained in:
AFCMS 2021-06-24 11:54:15 +02:00
parent 84900b39ad
commit 5ddc3cf99a
1 changed files with 39 additions and 4 deletions

View File

@ -1,10 +1,45 @@
--TODO: like mc error message
--TODO: complex command handling
mcl_commands.types = { mcl_commands.types = {
bool = {}, bool = {
int = {}, lengh = 1,
msg = "Invalid boolean",
func = function(word)
if word == "true" then
return true, true
elseif world == "false" then
return true, false
else
return false, nil
end
end,
},
int = {
lengh = 1,
msg = "Invalid integer",
func = function(int)
if tonumber(int) and tonumber(int) == math.round(int) then
return true, tonumber(int)
else
return false, nil
end
end,
},
float = {}, float = {},
word = {}, word = {},
text = {}, text = {},
pos = {}, pos = {
lengh = 3,
msg = "Invalid position",
func = function(x, y, z)
if true then
return true, nil
else
return false, nil
end
end,
},
target = {}, target = {},
playername = {}, playername = {},
} }
@ -12,7 +47,7 @@ mcl_commands.types = {
function mcl_commands.register_complex_command() function mcl_commands.register_complex_command()
end end
function mcl_commands.register_basic_command() function mcl_commands.register_basic_command(name, table)
end end
function mcl_commands.alias_command(alias, original_name, bypass_setting) function mcl_commands.alias_command(alias, original_name, bypass_setting)