Hi, I would like to know how I can get the numbervalue of a tablevalue. If you dont know what I mean here’s an example what I need to get in the script.
Picture where I printed a table:
Does anybody know how I can get the number of a table value?
Hi, I would like to know how I can get the numbervalue of a tablevalue. If you dont know what I mean here’s an example what I need to get in the script.
Picture where I printed a table:
Does anybody know how I can get the number of a table value?
you would probably want to took into tables!
info here:
https://developer.roblox.com/en-us/api-reference/lua-docs/table
if you want to get the index of a value you’d want to use:
local i = {
[1] = 'Hello';
[2] = 'World';
[3] = 'How Is';
[4] = 'Your Day?';
}
print(table.find(i, 'How Is') -- will return 2
if you want to get the value though you can do:
local i = {
[1] = 'Hello';
[2] = 'World';
[3] = 'How Is';
[4] = 'Your Day?';
}
print(i[2]) -- will return 'World'
print(i[4]) -- will return 'Your Day?'
if you have anymore questions, reply to this!
Thank you for your help. Actually my table in the script is empty at the beginning so I just needed print(table.find(i, -)