From 6fbec4ab8fccb9d4a819109da2a01032e68e563f Mon Sep 17 00:00:00 2001 From: Alexey Gulev Date: Mon, 4 Jun 2018 08:48:46 +0300 Subject: [PATCH] preventing double preload of the screen (#20) * preventing double preload of the screen --- monarch/monarch.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/monarch/monarch.lua b/monarch/monarch.lua index bfe63af..cea6e59 100644 --- a/monarch/monarch.lua +++ b/monarch/monarch.lua @@ -436,6 +436,10 @@ function M.preload(id, cb) assert(screens[id], ("There is no screen registered with id %s"):format(tostring(id))) local screen = screens[id] + if screen.preloaded then + if cb then cb() end + return + end local co co = coroutine.create(function() screen.co = co