Say I have this script...
1 | local Passes = { [ "DjDoor" ] = 4846905 |
2 | } |
How would I be able to to get the name "DjDoor" if I had the ID 4846905? Would I have to make ["DjDoor"] an array and add another string like this...?
1 | local Passes = { [ "DjDoor" ] = { 4846905 , "DjDoor" } |
2 | } |
Or is there another way to obtain it?
Just use a key-value for loop:
1 | for key, value in pairs (Passes) do |
2 | if value = = 4846905 then |
3 | print (key, value) -- You can access both |
4 | end |
5 | end |