aboutsummaryrefslogtreecommitdiff
path: root/types/ltn12.d.tl
blob: cd2375fcd696c884574c5852c612687cca9f7f99 (plain)
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

local record ltn12
    type Filter = function(string): string, string
    type Sink = function(string, string): boolean, string
    type Source = function(): string, string
 
    type FancySink = function(string, string): boolean, string | FancySink
    type FancySource = function(): string, string | FancySource
 
    -- Docs just say returns a truthy value on success
    -- Since this value should really only be
    -- used to check for truthiness, any seems fine here
    type Pump = function(Source, Sink): any, string
 
    record filter
       chain: function(Filter, Filter, ...: Filter): Filter
 
       cycle: function(string, string, any): Filter
    end
    record pump
       all: Pump
       step: Pump
    end
    record sink
       chain: function(Filter, Sink): Sink
       error: function(string): Sink
       file: function(FILE, string): Sink
       null: function(): Sink
       simplify: function(FancySink): Sink
       table: function({string}): Sink, {string}
    end
    record source
       cat: function(Source, ...: Source): Source
       chain: function(Source, Filter): Source
       empty: function(): Source
       error: function(string): Source
       file: function(FILE): Source
       file: function(FILE, string): Source
       simplify: function(FancySource): Source
       string: function(string): Source
       table: function({string}): Source, {string}
    end
 end
 
 return ltn12