add float type

This commit is contained in:
AFCMS 2021-06-24 14:04:15 +02:00
parent 102f45336b
commit 6d1bc8f865
1 changed files with 14 additions and 1 deletions

View File

@ -4,6 +4,8 @@ local S = minetest.get_translator(minetest.get_current_modname())
--TODO: complex command handling --TODO: complex command handling
--TODO: mc like help system --TODO: mc like help system
/setblock non 2 2 0 true {}
mcl_commands.types = { mcl_commands.types = {
bool = { bool = {
lengh = 1, lengh = 1,
@ -29,7 +31,17 @@ mcl_commands.types = {
end end
end, end,
}, },
float = {}, float = {
lengh = 1,
msg = S("Invalid integer"),
func = function(float)
if tonumber(float) then
return true, tonumber(float)
else
return false, nil
end
end,
},
word = {}, word = {},
text = {}, text = {},
pos = { pos = {
@ -61,6 +73,7 @@ mcl_commands.types = {
function mcl_commands.register_complex_command() function mcl_commands.register_complex_command()
end end
--aims to avoid complexity for basic commands while keeping proper messages and privs management
function mcl_commands.register_basic_command(name, def) function mcl_commands.register_basic_command(name, def)
end end