techmeet.love/errors.lua

19 lines
710 B
Lua

function add_error(err)
print(err)
log(2, 'add_error: '..err)
table.insert(Error_log.lines, {mode='text', data=err})
table.insert(Error_log.line_cache, {})
Current_error = err
Current_error_time = App.get_time()
end
function show_error(err)
if Current_error == nil then return end
local left = math.max(0, 1/2*(App.screen.width-Display_settings.font:getWidth(Current_error)-10))
local width = math.min(App.screen.width, Display_settings.font:getWidth(Current_error)+20)
App.color{r=0.6,g=0,b=0}
love.graphics.rectangle('fill', left, Menu_status_bar_height, width, Line_height+10)
App.color{r=1.0,g=0.8,b=0.8}
love.graphics.print(Current_error, left+10, Menu_status_bar_height+5)
end