Skip to content

Have you ever been jelaous of how pretty SQL prints? Here is gfxTables to help you!

License

Notifications You must be signed in to change notification settings

alejandro-alzate/gfxTables.lua

Repository files navigation

gfxTables.lua

Have you ever been jealous of how pretty SQL consoles prints? Here gfxTables to help you!

To do:

  • lua table to gfxTable and vice versa

Features

  • Simple API
  • Easy to work with

Getting started

  1. 📡 Get a copy of srt.lua from the Official Repository or From Luarocks

  2. 💾 Copy gfxTables.lua where you like to use it, or just on the root directory of the project

  3. ⚙ Add it to your project like this:

    local gfxTables = require("path/to/gfx/Tables")
  4. 📃 Create a new table object:

    local coolTable = gfxTables.newTable()
  5. 🎮 Play with it's api to see how it works

    coolTable:setShowEnumerator(true)
    --Now in the left side will be a number indexing items
    --Starting from 1 jus like god intended
    coolTable:setDefaultEntryValue("empty")
    --When a cell has not been defined it will print "empty"
    coolTable:setPadding(2)
    --2 spaces between walls and text
    coolTable:insertColumns("First Name", "Last Name", "Email")
    --Now the table contains 3 columns use :inserttColumn() for finer
    --control on individual columns
    coolTable:insertEntry({"Alejandro", "Alzate", "[email protected]"})
    
    --Not joking just print it directly
    print(coolTable)
  6. 💎 Look at that beauty and profit!

    	local gfxTables = require("gfxTables")
    	local coolTable = gfxTables.newTable()
    	coolTable:setShowEnumerator(true)
    	coolTable:setSeparateEntries(true)
    	coolTable:setDefaultEntryValue("empty")
    	coolTable:setPadding(2)
    	coolTable:insertColumns("First Name", "Last Name", "Email")
    	coolTable:insertEntry({"Alejandro", "Alzate", "[email protected]"})
    	print(coolTable)

    By running our script main.lua with those lines $ lua main.lua

    we get:

    ┏━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
    ┃  #  ┃  First Name  ┃  Last Name  ┃  Email                        ┃
    ┡━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
    |  1  |  Alejandro   |  Alzate     |  [email protected]  |
    └─────┴──────────────┴─────────────┴───────────────────────────────┘
    

About

Have you ever been jelaous of how pretty SQL prints? Here is gfxTables to help you!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages