Skip to content

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

Notifications You must be signed in to change notification settings

wrq/icecream-lua

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Lua 100.0%