mirror of
https://github.com/usysrc/LICK.git
synced 2024-11-24 16:44:21 +00:00
Merge pull request #1 from davidgomes/patch-1
Fixed indentation from tabs to spaces, and cleaned up the code a bit.
This commit is contained in:
commit
fb9319c889
13
lick.lua
13
lick.lua
@ -2,8 +2,6 @@
|
||||
--
|
||||
-- simple LIVECODING environment with löve, overwrites love.run, pressing all errors to the terminal/console
|
||||
|
||||
|
||||
|
||||
local lick = {}
|
||||
lick.file = "main.lua"
|
||||
lick.debug = false
|
||||
@ -31,16 +29,17 @@ local function update(dt)
|
||||
lick.debugoutput = chunk .. "\n"
|
||||
end
|
||||
ok,err = xpcall(chunk, handle)
|
||||
|
||||
if not ok then
|
||||
print(tostring(err))
|
||||
if lick.debugoutput then
|
||||
lick.debugoutput = (lick.debugoutput .."ERROR: ".. err .. "\n" )
|
||||
else lick.debugoutput = err .. "\n" end
|
||||
end
|
||||
if ok then
|
||||
else
|
||||
print("CHUNK LOADED\n")
|
||||
lick.debugoutput = nil
|
||||
end
|
||||
|
||||
if lick.reset then
|
||||
loadok, err = xpcall(love.load, handle)
|
||||
if not loadok and not loadok_old then
|
||||
@ -74,6 +73,7 @@ local function draw()
|
||||
lick.debugoutput = (lick.debugoutput .. err .. "\n" )
|
||||
else lick.debugoutput = err .. "\n" end
|
||||
end
|
||||
|
||||
if lick.debug and lick.debugoutput then
|
||||
love.graphics.setColor(255,255,255,120)
|
||||
love.graphics.printf(lick.debugoutput, (love.graphics.getWidth()/2)+50, 0, 400, "right")
|
||||
@ -83,12 +83,10 @@ end
|
||||
|
||||
|
||||
function love.run()
|
||||
|
||||
math.randomseed(os.time())
|
||||
math.random() math.random()
|
||||
load()
|
||||
|
||||
|
||||
local dt = 0
|
||||
|
||||
-- Main loop time.
|
||||
@ -105,6 +103,7 @@ function love.run()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
love.handlers[e](a,b,c,d)
|
||||
end
|
||||
end
|
||||
@ -124,9 +123,7 @@ function love.run()
|
||||
|
||||
if love.timer then love.timer.sleep(0.001) end
|
||||
if love.graphics then love.graphics.present() end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return lick
|
Loading…
Reference in New Issue
Block a user