Comparison

util/stanza.lua @ 12138:644ca3583837

util.stanza: Make type error message consistent with others
author Kim Alvefur <zash@zash.se>
date Fri, 31 Dec 2021 13:52:11 +0100
parent 11960:12a3c05aa12d
child 12140:1a4c61253932
comparison
equal deleted inserted replaced
12137:4e61aaa4e9b2 12138:644ca3583837
63 end 63 end
64 64
65 local function check_attr(attr) 65 local function check_attr(attr)
66 if attr ~= nil then 66 if attr ~= nil then
67 if type(attr) ~= "table" then 67 if type(attr) ~= "table" then
68 error("invalid attributes, expected table got "..type(attr)); 68 error("invalid attributes: expected table, got "..type(attr));
69 end 69 end
70 for k, v in pairs(attr) do 70 for k, v in pairs(attr) do
71 check_name(k, "attribute"); 71 check_name(k, "attribute");
72 check_text(v, "attribute"); 72 check_text(v, "attribute");
73 if type(v) ~= "string" then 73 if type(v) ~= "string" then