Skip to content

Latest commit

 

History

History
73 lines (49 loc) · 1 KB

README.md

File metadata and controls

73 lines (49 loc) · 1 KB

IceCream-lua

Never use print() to debug again. (lua)

lua version of IceCraem.

install

luarocks install icecream-lua

use

improt module:

local ic = require("icecream")

just use ic() to print information

The example of printing variables

a = 10
ic(a)
local x = 1
local y = 2
ic(x,y)

output ic| a = 1 and ic| x = 1, y = 1

The exmple of printing function

local function fun1(a) 
    return a + 1 
end
ic(fun1(22))

output ic| fun1(22) = 23

The exmple when there are no parameters

ic()

output: ic| + filename + line + function, like this: ic| /home/wlz/gh/icecream-lua/main.lua:37: in local 'testNoArg'

The exmple when there is no variable name

ic(1, 2)

output: ic| 1, 2

The exmple of display line munber

ic(x,y)
-- ic| x = 1, y = 1
ic:SetIsOutPutPosition(true)
ic(x,y)
-- /home/wlz/gh/icecream-lua/main.lua:11: in local 'testPosition'
-- ic| x = 1, y = 1