DatPsychopath Posted October 7, 2022 Share Posted October 7, 2022 Hi, I have a problem with using a value from a table. If I do this it works: local bandana = false bandanahave = exports['items']:getBadges() for key, value in pairs(bandanahave) do if getElementData(source, value[1]) then bandana = true end end However, if I add this (value[4] is indicating the ID of the item), it doesn't work: local bandana = false bandanahave = exports['items']:getBadges() for key, value in pairs(bandanahave) do if getElementData(source, value[1]) then if value[4] == 158 then bandana = true end end end Table: function getBadges() return { [158] = { "green bandana", "green bandana", {[-1] = true},{50,150,50},158}, } end I would appreciate any help in advance, thanks. Link to comment
AngelAlpha Posted October 7, 2022 Share Posted October 7, 2022 value[4] is array {50, 150,50}, you need value[5] 1 Link to comment
DatPsychopath Posted October 8, 2022 Author Share Posted October 8, 2022 My problem was solved thanks to AngelAlpha. Thanks again AngelAlpha for help! This topic can be locked now. Link to comment
AngelAlpha Posted October 8, 2022 Share Posted October 8, 2022 1 hour ago, DatPsychopath said: My problem was solved thanks to AngelAlpha. Thanks again AngelAlpha for help! This topic can be locked now. like me if i help you, pls) 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now