-3

here my code blows up: love.graphics.print(jugador..'['..i..']', i * 100, 10) I tried 'jugador'..'['..i..']' so i want help to get this jugador[1], jugador[2], jugador[n] treated a an indexing attempt not a text or something else...

  • 2
    I can't tell if you want a value (`jugador[i]`) or a string (`'jugador['..i..']'`). If neither of those work, please read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and update your question accordingly. – luther Aug 15 '21 at 18:13
  • @luther i want the value "color" in 'n' of idexes (uhhh error edit sorry) this is fed into jugador[number of player]: jugadorbase = {} jugadorbase.x = 100 jugadorbase.y = 300 jugadorbase.vidas = 4 jugadorbase.color = 0, 1, 1 i want extract this for every player jugadorbase.tamañox = 20 etc (it dont fit) like: jugador[1].color =>"0, 1, 1" and for contrast: jugador[2].color => "0.5, 1, 0.125" Sorry for the weird reply i blame literally a blackout – Alejandro Alzate Sánchez Aug 15 '21 at 22:48
  • I don't understand how that relates to what you wrote in your question. I can only reiterate my previous comment. Note that you can edit your question by clicking "Edit". – luther Aug 15 '21 at 23:15
  • anyway i found another way (function getKey(table)), but thx by ur time, and not getting annoyed by me – Alejandro Alzate Sánchez Aug 17 '21 at 04:18

1 Answers1

1
love.graphics.print(jugador[i], i * 100, 10)

is what you want, or based on your description in the comments

local color = jugador[i].color
local str = color[1] .. ", " .. color[2] .. ", " .. color[3]
love.graphics.print(str, i * 100, 10)

You will also need to understand loops loops.

As luther said, please provide a minimal example and edit your question with the important additional information given in your comment.

Luke100000
  • 1,395
  • 2
  • 6
  • 18