love.draw - How to run contents of a table

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
aeos
Prole
Posts: 3
Joined: Tue Mar 21, 2023 3:42 pm

love.draw - How to run contents of a table

Post 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
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

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

Post 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}
obey
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

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

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest