Obtaining values from a table
Obtaining values from a table
Hi, I¨ve quite a silly problem. I want to find out bitmap font's sizes but GetAvailableFonts() returns something like "Table: 0x25F136" or so... and the same goes for the TextExtent() command...please how can i get values from this? I have never come across this so far...thanx pecaN
Re: Obtaining values from a table
I pecaN,
generally you can obtain values from a table depending on the table index, for example if you have a table indexed by numeric values:
(*Note)
You can obtain the first item with:
the secondo item with
and so on...
You can also have tables indexed by strings, for example:
This time you can obtain values with:
or even better
For your specific question you have to look at the documentation of GetAvailableFonts() and see what fields it returns, so you can do something like:
I don't have near me the Hollywood doc so I have used returned_field as a placeholder for the real field returned by this function
(*Note)
note that you can write the table assignment with:too
generally you can obtain values from a table depending on the table index, for example if you have a table indexed by numeric values:
Code: Select all
Local mytable = { "alpha", "beta", "gamma" }
You can obtain the first item with:
Code: Select all
Print(mytable[0])
Code: Select all
Print(mytable[1])
You can also have tables indexed by strings, for example:
Code: Select all
Local mytable = { item1 = "alpha", itembeta = "beta", gamma = "gamma" }
Code: Select all
Print(mytable["item1"])
Code: Select all
Print(mytable.item1)
Print(mytable.itembeta)
Print(mytable.gamma)
Code: Select all
Local af = GetAvailableFonts()
Print(af.returned_field)
(*Note)
note that you can write the table assignment with:
Code: Select all
Local mytable = { [0] = "alpha", [1] = "beta", [2] = "gamma" }
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Obtaining values from a table
Hi Allanon,
txanx very much for your exhaustive reply (as always!), it helped me solve my problem !!! Regards pecaN
txanx very much for your exhaustive reply (as always!), it helped me solve my problem !!! Regards pecaN
Re: Obtaining values from a table
Great!
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆