Software /
code /
prosody
Comparison
tools/form2table.lua @ 13142:879a6a33c21b
tools: Update imports to use new prosody.* namespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 08 Jun 2023 09:37:01 +0200 |
parent | 11194:9d1ce6f28401 |
comparison
equal
deleted
inserted
replaced
13141:451cb119026e | 13142:879a6a33c21b |
---|---|
1 -- Read an XML dataform and spit out a serialized Lua table of it | 1 -- Read an XML dataform and spit out a serialized Lua table of it |
2 if not pcall(require, "prosody.loader") then | |
3 pcall(require, "loader"); | |
4 end | |
2 | 5 |
3 local function from_stanza(stanza) | 6 local function from_stanza(stanza) |
4 local layout = { | 7 local layout = { |
5 title = stanza:get_child_text("title"); | 8 title = stanza:get_child_text("title"); |
6 instructions = stanza:get_child_text("instructions"); | 9 instructions = stanza:get_child_text("instructions"); |
43 | 46 |
44 end | 47 end |
45 return layout; | 48 return layout; |
46 end | 49 end |
47 | 50 |
48 print("dataforms.new " .. require "util.serialization".serialize(from_stanza(require "util.xml".parse(io.read("*a"))), { unquoted = true })) | 51 print("dataforms.new " .. require"prosody.util.serialization".serialize(from_stanza(require"prosody.util.xml".parse(io.read("*a"))), |
52 { unquoted = true })) |