What I’m doing is bypassing the shadow class and requiring the light class directly, then using the code that I listed above. I am doing it this way for testing purposes to make sure the performance doesn’t plummet. It seems like my lag comes from the vector points using the shadows which is why I am by passing them by requiring the light class and adding a light directly instead of through the shadow class. Also it only does that error when calling the Light:Remove() or adding it to the sceneGroup class and using the composer.removeScene()
So my exact code is:
local light = require("2dshadows.light") light1 = light:new( 2, {0,1,0}, 1, 4 ) light1.x = -10 light1.y = -10 light1:SetDraggable(false) sceneGroup:insert(light1)
That is literally all I am calling in my class, works perfect to. The -10 x and y is to set it in the upper corner of the screen. I can even drag it fine when I don’t set the draggable to false. I’m pretty decent with Lua, which is why I know its trying to remove a object that has a value of 0. What I am thinking is that because I am calling the light directly instead of through the shadow class, I’m not using a initializing a value which the vector 2d class requires to update the lens flare, which in turn, allows me to remove the light. Also I just tested it without lens flares and it still does the error. So what I’ll do now is require the shadow class and add a light that way, see if anything changes.