In pointlight, spotlight, and the other similar light sources, I get an error about accessing a nil item when creating an instance.
It looks like M.setup() is called at least once before the window is created. At that time, the setup function won't create the ofLight object -- but then its logic is of the form:
If the window exists:
Then create the window and set some properties.
Always set the abstraction's user facing parameters -- and these functions set properties of the ofLight object (which may not exist if the window didn't exist -- here's the error).
I can think of two solutions:
Move the parameter-setting functions into the if block, not outside.
Or, guarantee that the setup function will not fire until the window is ready.
In my revisions, I did the first. If the second is better, that would be ok too.
Thanks, that's true. I also removed the light:disable() causing an error when the object was removed.
Anyway, lights are a bit confusing and sometimes unstable.
In pointlight, spotlight, and the other similar light sources, I get an error about accessing a nil item when creating an instance.
It looks like
M.setup()
is called at least once before the window is created. At that time, the setup function won't create the ofLight object -- but then its logic is of the form:I can think of two solutions:
In my revisions, I did the first. If the second is better, that would be ok too.