-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoml.d.tl
160 lines (123 loc) · 5.53 KB
/
toml.d.tl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
--- Encodes, decodes, and converts TOML documents.
local record toml
--- Decodes a TOML document into a Lua table. If `tomlStr` is invalid, an error table that describes the error in the document is returned.
--- @param tomlStr string: The string containing a TOML document.
--- @param options DecodingOptions|nil: See docs for DecodingOptions.
--- @return table: The decoded TOML document.
decode: function(tomlStr: string, options: DecodingOptions|nil): { string: any }
--- Decodes a TOML document into a Lua table. If `tomlStr` is invalid, an error table that describes the error in the document is returned.
--- @param filePath string: The path to the TOML document.
--- @param options DecodingOptions|nil: See docs for DecodingOptions.
--- @return table: The decoded TOML document.
decodeFromFile: function(filePath: string, options: DecodingOptions|nil): { string: any }
--- Encodes a Lua table into a TOML document.
--- @param data table: The Lua table to be encoded.
--- @param options FormattingOptions|nil: Options for formatting the YAML document. Pass `{}` to remove all options, or no table to use the default options.
--- @return string: The encoded TOML document.
encode: function(data: { string: any }, options: FormattingOptions|nil): string
--- Encodes a Lua table into a TOML document, and **appends** that document to a file.
--- @param data table: The Lua table to be encoded.
--- @param file string: The file to write the document to.
--- @param options FormattingOptions|nil: Options for formatting the YAML document. Pass `{}` to remove all options, or no table to use the default options.
encodeToFile: function(data: { string: any }, fileOrOptions: string|EncodeToFileOptions, options: FormattingOptions|nil)
--- Converts a table, or a TOML document into a JSON document.
--- @param toml string|{ string: any }: A string containing a TOML document, or a table.
--- @param options FormattingOptions|nil: Options for formatting the YAML document. Pass `{}` to remove all options, or no table to use the default options.
--- @return string: The converted JSON document.
toJSON: function(toml: string|{ string: any }, options: FormattingOptions|nil): string
--- Converts a table, or a TOML document into a YAML document.
--- @param toml string|{ string: any }: A string containing a TOML document, or a table.
--- @param options FormattingOptions|nil: Options for formatting the YAML document. Pass `{}` to remove all options, or no table to use the default options.
--- @return string: The converted YAML document.
toYAML: function(toml: string|{ string: any }, options: FormattingOptions|nil): string
record Date
userdata
year: number
month: number
day: number
new: function(year: number, month: number, day: number): Date
metamethod __tostring: function(Date): string
end
record Time
userdata
hour: number
minute: number
second: number
nanoSecond: number
new: function (
hour: number,
minute: number,
second: number,
nanoSecond: number
): Time
metamethod __tostring: function(Time): string
end
record TimeOffset
userdata
minutes: number
new: function (hours: number, minutes: number): TimeOffset
metamethod __tostring: function(TimeOffset): string
end
record DateTime
userdata
date: Date
time: Time
TimeOffset: nil | TimeOffset
new: function(date: Date, time: Time): DateTime
new: function(date: Date, time: Time, timeOffset: TimeOffset): DateTime
metamethod __tostring: function(DateTime): string
end
record Int
userdata
int: number
new: function(int: number, flags: formatting.int): Int
metamethod __tostring: function(Int): string
end
record formatting
record int
binary: number
octal: number
hexadecimal: number
end
end
record DecodingOptions
formattedIntsAsUserData: boolean
temporalTypesAsUserData: boolean
end
record EncodeToFileOptions
file: string
overwrite: boolean
end
record FormattingOptions
--- Dates and times will be emitted as quoted strings.
quoteDatesAndTimes: boolean
--- Infinities and NaNs will be emitted as quoted strings.
quoteInfinitesAndNaNs: boolean
--- Strings will be emitted as single-quoted literal strings where possible.
allowLiteralStrings: boolean
--- Strings containing newlines will be emitted as triple-quoted 'multi-line' strings where possible.
allowMultiLineStrings: boolean
--- Allow real tab characters in string literals (as opposed to the escaped form `\t`).
allowRealTabsInStrings: boolean
--- Allow integers with formatAsBinary to be emitted as binary.
allowBinaryIntegers: boolean
--- Allow integers with formatAsOctal to be emitted as octal.
allowOctalIntegers: boolean
--- Allow integers with formatAsHexadecimal to be emitted as hexadecimal.
allowHexadecimalIntegers: boolean
--- Apply indentation to tables nested within other tables/arrays.
indentSubTables: boolean
--- Apply indentation to array elements when the array is forced to wrap over multiple lines.
indentArrayElements: boolean
--- Combination of `indentSubTables` and `indentArrayElements`.
indentation: boolean
--- Emit floating-point values with relaxed (human-friendly) precision.
--- Warning: Setting this flag may cause serialized documents to no longer round-
--- trip correctly since floats might have a less precise value upon being written out
--- than they did when being read in. Use this flag at your own risk.
relaxedFloatPrecision: boolean
--- Avoids the use of whitespace around key-value pairs.
terseKeyValuePairs: boolean
end
end
return toml