Jump to content

Can't add table to gridlist


spaghetti1337

Recommended Posts

Why I can't add items from "myVehicles" table?

If I do outputChatBox then works like a charm, but the gridlist shows nothing.

myVehicles = {}

	for key, value in ipairs(getElementsByType("vehicle")) do
		if getElementData(value, "veh >> owner") == getElementData(localPlayer, "acc >> id") then
			table.insert(myVehicles, value)
		end
	end

for key, value in ipairs(myVehicles) do
  outputChatBox(getElementData(value, "veh >> id")) --- I have 6 vehicles and displays all of them in the chat
  gridlist:AddItem(1, getElementData(value, "veh >> id")) --- shows nothing in the gridlist I also tried with tonumber(getElementData(value, "veh >> id"))
end

if I just change the 

gridlist:AddItem(1, getElementData(value, "veh >> id"))

to

gridlist:AddItem(1, "test")

then displays 6 "test" in the gridlist so the table works fine but can't get the veh id inside the gridlist

Link to comment
  • Tut locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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