[Custom Views] Make 'register_view' accept table
This commit is contained in:
parent
e2111213d8
commit
71f3bc55af
1 changed files with 4 additions and 10 deletions
|
@ -297,18 +297,12 @@ end
|
|||
Opens a file with a view data and validates it. Registers the view and returns 'true' if everything is correct.
|
||||
* view_data_file_path [string]: path to a file returning view_data table
|
||||
--]]
|
||||
function VMFMod:register_view(view_data_file_path)
|
||||
local success, view_data = vmf.safe_call_dofile(self, {ERRORS.PREFIX["register_view_open_file"], view_data_file_path},
|
||||
view_data_file_path)
|
||||
if success then
|
||||
if type(view_data) ~= "table" then
|
||||
self:error(ERRORS.REGULAR["view_data_wrong_type"], view_data_file_path, type(view_data))
|
||||
function VMFMod:register_view(view_data)
|
||||
if vmf.check_wrong_argument_type(self, "register_view", "view_data", view_data, "table") then
|
||||
return
|
||||
end
|
||||
|
||||
view_data = table.clone(view_data)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local view_name = view_data.view_name
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue