[Table Dump] Better arguments checks

This commit is contained in:
Azumgi 2018-10-11 12:36:00 +03:00
parent 964e6f6e6f
commit fcffb8a2d3

View file

@ -41,8 +41,9 @@ end
VMFMod.dump = function (self, dumped_object, dumped_object_name, max_depth) VMFMod.dump = function (self, dumped_object, dumped_object_name, max_depth)
if not dumped_object or not max_depth then if vmf.check_wrong_argument_type(self, "dump", "dumped_object_name", dumped_object_name, "string", "nil") or
self:error("(dump): not all arguments are specified.") vmf.check_wrong_argument_type(self, "dump", "max_depth", max_depth, "number")
then
return return
end end
@ -327,8 +328,9 @@ end
VMFMod.dump_to_file = function (self, dumped_object, object_name, max_depth) VMFMod.dump_to_file = function (self, dumped_object, object_name, max_depth)
if not dumped_object or not object_name or not max_depth then if vmf.check_wrong_argument_type(self, "dump_to_file", "object_name", object_name, "string") or
self:error("(dump_to_file): not all arguments are specified.") vmf.check_wrong_argument_type(self, "dump_to_file", "max_depth", max_depth, "number")
then
return return
end end