undefined Posted September 3, 2014 Share Posted September 3, 2014 Hi guys. Im tryed this but it's not on the skillWindow. Image: Code: data = { background = { {10, 54, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 105, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 156, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 207, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 258, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 309, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 360, 550, 41, ":test/Adsiz.png", false, skillWindow} } } local back = {} addEventHandler("onClientResourceStart", resourceRoot, function() skillWindow = guiCreateWindow(369, 143, 570, 418, "test", false) guiWindowSetSizable(skillWindow, false) guiSetAlpha(skillWindow, 0.85) for k, v in pairs(data.background) do back[k] = guiCreateStaticImage(unpack(v)) end end) Where is the problem? Link to comment
Arsilex Posted September 3, 2014 Share Posted September 3, 2014 data = { background = { {10, 54, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 105, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 156, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 207, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 258, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 309, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 360, 550, 41, ":test/Adsiz.png", false, skillWindow} } } local back = {} addEventHandler("onClientResourceStart", resourceRoot, function() skillWindow = guiCreateWindow(369, 143, 570, 418, "test", false) guiWindowSetSizable(skillWindow, false) guiSetAlpha(skillWindow, 0.85) for k, v in ipairs(data.background) do back[k] = guiCreateStaticImage(unpack(v)) end end) Link to comment
Moderators DNL291 Posted September 4, 2014 Moderators Share Posted September 4, 2014 (edited) Because skillWindow is returning nil in the table you created. Try this: data = {} local back = {} addEventHandler("onClientResourceStart", resourceRoot, function() skillWindow = guiCreateWindow(369, 143, 570, 418, "test", false) data.background = { {10, 54, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 105, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 156, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 207, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 258, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 309, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 360, 550, 41, ":test/Adsiz.png", false, skillWindow} } guiWindowSetSizable(skillWindow, false) guiSetAlpha(skillWindow, 0.85) for i, v in ipairs(data.background) do back[i] = guiCreateStaticImage(unpack(v)) end end) data = { background = { {10, 54, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 105, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 156, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 207, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 258, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 309, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 360, 550, 41, ":test/Adsiz.png", false, skillWindow} } } local back = {} addEventHandler("onClientResourceStart", resourceRoot, function() skillWindow = guiCreateWindow(369, 143, 570, 418, "test", false) guiWindowSetSizable(skillWindow, false) guiSetAlpha(skillWindow, 0.85) for k, v in ipairs(data.background) do back[k] = guiCreateStaticImage(unpack(v)) end end) Well, from what i see it looks the same code that AbaZaSiRiN00 posted. Edited September 5, 2014 by Guest Link to comment
Mr.Aleks Posted September 4, 2014 Share Posted September 4, 2014 No, they're different. He has changed "pairs" by "ipairs". Link to comment
Et-win Posted September 4, 2014 Share Posted September 4, 2014 'skillWindow' is not defined, because the table is above the function which creates the window. Put the table under/in the function, or put the 'guiCreateWindow' above the table. Link to comment
Arsilex Posted September 4, 2014 Share Posted September 4, 2014 I just tested my code and it works perfectly has nothing to do with "skillWindow" only need need change pairs -- > ipairs because the table what he try to loop have indexes Link to comment
Moderators DNL291 Posted September 5, 2014 Moderators Share Posted September 5, 2014 I just tested my code and it works perfectly has nothing to do with "skillWindow" only need need change pairs -- > ipairs because the table what he try to loop have indexes No, the images is still without a parent element since it's being created out of the window, which means that skillWindow is returning nil. No, they're different. He has changed "pairs" by "ipairs". Ah, didn't realize it. By the way, i've tested my code and it works fine. 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