Jump to content

getElementData


Xwad

Recommended Posts

local gui1 = {"496","Pz.Kpfw. II","pz2","50","40","11","50","30","20","15"}
local gui2 = {"401","Pz.Kpfw. III","pz3","50","64","70","40","50","30","50"}
local gui3 = {"517","Hetzer","hetzer","50","42","110","40","50","30","50"}

local img1 = guiCreateStaticImage( 100, 100, 175, 127.5, "files/images/pz2.png", false, tab2 )
local img2 = guiCreateStaticImage( 500, 200, 175, 127.5, "files/images/pz3.png", false, tab2 )
local img3 = guiCreateStaticImage( 100, 300, 175, 127.5, "files/images/hetzer.png", false, tab2 )

setElementData(img1, "data", gui1)
setElementData(img2, "data", gui2)
setElementData(img3, "data", gui3)


for i,v in ipairs(getElementsByType("gui-staticimage")) do
	local data = getElementData(v,"data")
	local x,y = guiGetPosition(v, false)
	local label = guiCreateLabel ( x,y, 150,20, data[2], false, tab2 )
end

Inside the looping, the data variable has no value (a boolean value). Its a mystery for me. I checked everythink 100x times, but does not work.

Edited by Xwad
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...