mirror of
https://github.com/usysrc/LICK.git
synced 2024-11-16 09:34:22 +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
|
-- simple LIVECODING environment with löve, overwrites love.run, pressing all errors to the terminal/console
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local lick = {}
|
local lick = {}
|
||||||
lick.file = "main.lua"
|
lick.file = "main.lua"
|
||||||
lick.debug = false
|
lick.debug = false
|
||||||
@ -31,16 +29,17 @@ local function update(dt)
|
|||||||
lick.debugoutput = chunk .. "\n"
|
lick.debugoutput = chunk .. "\n"
|
||||||
end
|
end
|
||||||
ok,err = xpcall(chunk, handle)
|
ok,err = xpcall(chunk, handle)
|
||||||
|
|
||||||
if not ok then
|
if not ok then
|
||||||
print(tostring(err))
|
print(tostring(err))
|
||||||
if lick.debugoutput then
|
if lick.debugoutput then
|
||||||
lick.debugoutput = (lick.debugoutput .."ERROR: ".. err .. "\n" )
|
lick.debugoutput = (lick.debugoutput .."ERROR: ".. err .. "\n" )
|
||||||
else lick.debugoutput = err .. "\n" end
|
else lick.debugoutput = err .. "\n" end
|
||||||
end
|
else
|
||||||
if ok then
|
|
||||||
print("CHUNK LOADED\n")
|
print("CHUNK LOADED\n")
|
||||||
lick.debugoutput = nil
|
lick.debugoutput = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if lick.reset then
|
if lick.reset then
|
||||||
loadok, err = xpcall(love.load, handle)
|
loadok, err = xpcall(love.load, handle)
|
||||||
if not loadok and not loadok_old then
|
if not loadok and not loadok_old then
|
||||||
@ -74,6 +73,7 @@ local function draw()
|
|||||||
lick.debugoutput = (lick.debugoutput .. err .. "\n" )
|
lick.debugoutput = (lick.debugoutput .. err .. "\n" )
|
||||||
else lick.debugoutput = err .. "\n" end
|
else lick.debugoutput = err .. "\n" end
|
||||||
end
|
end
|
||||||
|
|
||||||
if lick.debug and lick.debugoutput then
|
if lick.debug and lick.debugoutput then
|
||||||
love.graphics.setColor(255,255,255,120)
|
love.graphics.setColor(255,255,255,120)
|
||||||
love.graphics.printf(lick.debugoutput, (love.graphics.getWidth()/2)+50, 0, 400, "right")
|
love.graphics.printf(lick.debugoutput, (love.graphics.getWidth()/2)+50, 0, 400, "right")
|
||||||
@ -83,12 +83,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function love.run()
|
function love.run()
|
||||||
|
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
math.random() math.random()
|
math.random() math.random()
|
||||||
load()
|
load()
|
||||||
|
|
||||||
|
|
||||||
local dt = 0
|
local dt = 0
|
||||||
|
|
||||||
-- Main loop time.
|
-- Main loop time.
|
||||||
@ -105,6 +103,7 @@ function love.run()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
love.handlers[e](a,b,c,d)
|
love.handlers[e](a,b,c,d)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -124,9 +123,7 @@ function love.run()
|
|||||||
|
|
||||||
if love.timer then love.timer.sleep(0.001) end
|
if love.timer then love.timer.sleep(0.001) end
|
||||||
if love.graphics then love.graphics.present() end
|
if love.graphics then love.graphics.present() end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return lick
|
return lick
|
Loading…
Reference in New Issue
Block a user