flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
294 stars 25 forks source link

Error when Slab.Draw is called before Slab.Update #74

Closed PhoenixAran closed 3 years ago

PhoenixAran commented 3 years ago

Slab Version: 0.7.2

I get the following error: 'Error: lib/slab/Internal/Core/DrawCommands.lua:356: attempt to index local 'Layer' (a nil value)' when I override the love.run function as seen here

Here is a minimal reproduction main.lua file I believe this is caused by Slab.Draw() being called before the first Slab.Update() call.

In my current project I work around this by calling Slab.Update(0) after initializing Slab in love.load. I also remove the check for DidDraw inside Slab.Draw since I notice some flickering if Slab.Draw() is called in an update loop where Slab.Update() got skipped.

coding-jackalope commented 3 years ago

Hi @PhoenixAran, thanks for reporting this issue. A fix for this will be included in the next release.