Skip to content

Version 0.0.3

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 20 Jan 03:32
b6822e6

Added

  • Added networking functions under net

    Example usage:

    local apiResult = net.request({
    	url = "https://jsonplaceholder.typicode.com/posts/1",
    	method = "PATCH",
    	headers = {
    		["Content-Type"] = "application/json",
    	},
    	body = net.jsonEncode({
    		title = "foo",
    		body = "bar",
    	}),
    })
    
    local apiResponse = net.jsonDecode(apiResult.body)
    assert(apiResponse.title == "foo", "Invalid json response")
    assert(apiResponse.body == "bar", "Invalid json response")
  • Added console logging & coloring functions under console

    This piece of code:

    local tab = { Integer = 1234, Hello = { "World" } }
    console.log(tab)

    Will print the following formatted text to the console, with syntax highlighting:

    {
        Integer = 1234,
        Hello = {
            "World",
        }
    }

    Additional utility functions exist with the same behavior but that also print out a colored
    tag together with any data given to them: console.info, console.warn, console.error -
    These print out prefix tags [INFO], [WARN], [ERROR] in blue, orange, and red, respectively.

Changed

  • The json api is now part of net
    • json.encode becomes net.jsonEncode
    • json.decode become net.jsonDecode

Fixed

  • Fixed JSON decode not working properly