i am trying to capture a screenshot and share it at the same time on android .
i have used screenshot extension
local random = math.random(100) local path = sys.get_save_file("MyGame", "screenshot" .. random .. ".png") local png, w, h = screenshot.png() local f = io.open(path, "wb") f:write(png) f:flush() f:close() share.file(path)
whenever i call this bloc of code it blocks the game for about 3-4sec on android .
My question is how i can avoid this thread blocking , i have heard about
coroutines but i don’t know how to implement that in my case .