Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 1.41 KB

io.md

File metadata and controls

82 lines (56 loc) · 1.41 KB

io

common

pprint

'accepts (probably) anything

formats input as a readable string

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!!!!)

llib.io.log("meow")

readfile

'accepts a file path

returns the content of that file as a string

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

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

arg_handle

'accepts two tables 1 = table mapped with names and function 2 = args, or the list of strings to test

the first table accepts this layout

{ { list_of_keys, function_to_execute }, ... }

returns nothing, executes marked functions

llib.io.arg_handle({
    {
        {"test"},
        function()
            print("test")
        end,
    }, {
        {"test2","t"},
        function()
            print("test2")
        end,
    }
}, arg)