Xwad Posted March 21, 2019 Share Posted March 21, 2019 (edited) 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 March 21, 2019 by Xwad Link to comment
Enargy, Posted March 21, 2019 Share Posted March 21, 2019 Change data[2] to data only Link to comment
Xwad Posted March 21, 2019 Author Share Posted March 21, 2019 But i need the data[2]. Link to comment
Moderators IIYAMA Posted March 21, 2019 Moderators Share Posted March 21, 2019 getElementsByType("gui-staticimage", resourceRoot) Maybe you get other resource elements as well? Link to comment
Xwad Posted March 22, 2019 Author Share Posted March 22, 2019 Yes thats it. It was not working because the script had other gui static elements that didnt have the data. 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