mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
feat: boolean type support finally
This commit is contained in:
parent
b9074ebe47
commit
cc6891dde8
3 changed files with 12 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ class CommandParser : BasicParser {
|
|||
{"int", ArgType::integer},
|
||||
{"str", ArgType::string},
|
||||
{"sel", ArgType::selector},
|
||||
{"bool", ArgType::boolean},
|
||||
{"enum", ArgType::enumvalue},
|
||||
};
|
||||
public:
|
||||
|
|
@ -250,6 +251,11 @@ public:
|
|||
return selectorCheck(arg, value);
|
||||
case ArgType::integer:
|
||||
return typeCheck(arg, dv::value_type::integer, value, "integer");
|
||||
case ArgType::boolean:
|
||||
if (!arg->optional) {
|
||||
throw typeError(arg->name, "boolean", value);
|
||||
}
|
||||
return value.isBoolean();
|
||||
case ArgType::string:
|
||||
if (!value.isString()) {
|
||||
return !arg->optional;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue