Software /
code /
prosody
Comparison
teal-src/util/dataforms.d.tl @ 11432:113f3912c7cb
util: Add Teal interface definition files
Enables writing code in Teal that is aware of the interfaces and
function prototypes in these other utils.
Could also be used to do type checks on Lua sources, but this tends to
have a lot of noise.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 09 Mar 2021 14:36:46 +0100 |
child | 12614:d498e7e7853a |
comparison
equal
deleted
inserted
replaced
11431:4874b54af344 | 11432:113f3912c7cb |
---|---|
1 local stanza_t = require "util.stanza".stanza_t | |
2 | |
3 local enum form_type | |
4 "form" | |
5 "submit" | |
6 "cancel" | |
7 "result" | |
8 end | |
9 | |
10 local enum field_type | |
11 "boolean" | |
12 "fixed" | |
13 "hidden" | |
14 "jid-multi" | |
15 "jid-single" | |
16 "list-multi" | |
17 "list-single" | |
18 "text-multi" | |
19 "text-private" | |
20 "text-single" | |
21 end | |
22 | |
23 local record form_field | |
24 | |
25 type : field_type | |
26 var : string -- protocol name | |
27 name : string -- internal name | |
28 | |
29 label : string | |
30 desc : string | |
31 | |
32 datatype : string | |
33 range_min : number | |
34 range_max : number | |
35 | |
36 value : any -- depends on field_type | |
37 options : table | |
38 end | |
39 | |
40 local record dataform | |
41 title : string | |
42 instructions : string | |
43 { form_field } -- XXX https://github.com/teal-language/tl/pull/415 | |
44 | |
45 form : function ( dataform, table, form_type ) : stanza_t | |
46 end | |
47 | |
48 local record lib | |
49 new : function ( dataform ) : dataform | |
50 end | |
51 | |
52 return lib |