Page 1 of 1

love.draw - How to run contents of a table

Posted: Fri Mar 22, 2024 4:02 am
by aeos
I trying this execution:
setColor and rectangle loaded on a table, but on time of run in love.draw only do not execute nothing.
im using 11.5. if anyone help me on this.

example:

Code: Select all

> t = {"lg.setColor(1,0,0)","lg.rectangle('fill', 0, 20, 20, 100)"}
>love.draw()
>    How to proceed???
>end

Re: love.draw - How to run contents of a table

Posted: Fri Mar 22, 2024 4:44 am
by BrotSagtMist
Iterating with:
load(value)()
will work but you should really save the table contents as function instead strings.
t = {function() lg.setColor(1,0,0) end}

Re: love.draw - How to run contents of a table

Posted: Fri Mar 22, 2024 1:53 pm
by dusoft
I mean what's the point of this anyway?

Isn't it easier just to require draw objects locally (if they are supposed to be separated) instead of having them in tables?