aboutsummaryrefslogtreecommitdiff
path: root/docs/io.md
blob: dd5aff0649381362473d8397094adcc20cdbf1fe (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
46
47
48
49
50
51
52
53
54
# io 

## common 

### pprint

'accepts (probably) anything

formats input as a readable string

```lua
llib.io.pprint({a = 5, b = {9, 9, 22}})
```

#### config options

- print_type (0 | true) - whether or not to print item type (0 or 1)
- max_depth (2) - maximum depth that will not be collapsed
- start_nl_at (3) - maximum depth that will be kept in-line
- collapse_all (0 | false) - skip all newlines
- collapse_to_memory (1 | true) - print memory address instead of ...

### error/warn/log/debug 

'accepts a string 

outputs a fancy string (color!!!!)

```lua
llib.io.log("meow")
```

### readfile 

'accepts a file path

returns the content of that file as a string 

```lua
llib.io.readfile("./docs/io.md") -- (this file)
```
#### config options 

- file_chunksize (512) - size of chunk to be allocated

### json_parse 

'accepts a json string 

returns a table represented by the string 

```lua
llib.io.json_parse('{"test":[5,4,3]}') -- {"test" : {5, 4, 3}}
```