Changeset

8863:64fa8d80c09f

util.dataforms: Remove string conversion to let util.stanza validate types
author Kim Alvefur <zash@zash.se>
date Sat, 02 Jun 2018 19:49:15 +0200
parents 8862:900dff5ef498
children 8864:cf2f66b233d1
files util/dataforms.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/util/dataforms.lua	Sat Jun 02 19:47:09 2018 +0200
+++ b/util/dataforms.lua	Sat Jun 02 19:49:15 2018 +0200
@@ -8,7 +8,7 @@
 
 local setmetatable = setmetatable;
 local ipairs = ipairs;
-local tostring, type, next = tostring, type, next;
+local type, next = type, next;
 local t_concat = table.concat;
 local st = require "util.stanza";
 local jid_prep = require "util.jid".prep;
@@ -49,7 +49,7 @@
 						:add_child(value)
 						:up();
 				else
-					form:tag("value"):text(tostring(value)):up();
+					form:tag("value"):text(value):up();
 				end
 			elseif field_type == "boolean" then
 				form:tag("value"):text((value and "1") or "0"):up();
@@ -79,7 +79,7 @@
 								has_default = true;
 							end
 						else
-							form:tag("option", { label= val }):tag("value"):text(tostring(val)):up():up();
+							form:tag("option", { label= val }):tag("value"):text(val):up():up();
 						end
 					end
 				end
@@ -95,7 +95,7 @@
 								form:tag("value"):text(val.value):up();
 							end
 						else
-							form:tag("option", { label= val }):tag("value"):text(tostring(val)):up():up();
+							form:tag("option", { label= val }):tag("value"):text(val):up():up();
 						end
 					end
 				end