Jump to content

[HELP] A problem with using a value from a table.


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...