techmeet.love/errors.lua

19 lines
710 B
Lua
Raw Normal View History

2022-10-27 06:13:22 +00:00
function add_error(err)
print(err)
log(2, 'add_error: '..err)
2022-11-20 21:40:22 +00:00
table.insert(Error_log.lines, {mode='text', data=err})
table.insert(Error_log.line_cache, {})
2022-10-27 06:13:22 +00:00
Current_error = err
Current_error_time = App.get_time()
2022-10-27 06:13:22 +00:00
end
function show_error(err)
if Current_error == nil then return end
2024-01-15 10:20:18 +00:00
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)
2022-10-27 06:13:22 +00:00
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)
2022-10-27 06:13:22 +00:00
end