h4x7o0r Posted February 5, 2014 Share Posted February 5, 2014 (edited) Hey there, i'm having some issues with retrieving a list. So considering i'm having a gridlist (maps) populated with some maps. How can i insert that list to a table. LIke after the for loop to have tabel = { "maps1", "maps2") or something like this. I tried using something like this but it's not working Thanks in advance. Edited February 5, 2014 by Guest Link to comment
Sasu Posted February 5, 2014 Share Posted February 5, 2014 guiGridListGetItemText return a string, not a table. Replace line 5 to this one: table.insert(tabel, map) Edit: Where have you define 'maps'? Link to comment
h4x7o0r Posted February 5, 2014 Author Share Posted February 5, 2014 that's just a part of a script. maps = guiCreateGridList(0.52, 0.04, 0.44, 0.7,true,tabMaps) guiGridListSetSelectionMode(maps,2) guiGridListAddColumn(maps,"Added maps",1) Thanks for your reply. Tried what u've suggested. at for loop Error : Table expected, got userdata. Link to comment
TAPL Posted February 5, 2014 Share Posted February 5, 2014 Try this: local tabel = {} for i=0, guiGridListGetRowCount(maps) do table.insert(tabel, guiGridListGetItemText(maps, i, 1)) end Link to comment
h4x7o0r Posted February 5, 2014 Author Share Posted February 5, 2014 Thanks for your reply TAPL. This code's working well. It does what i need but with a lil mistake. i'm using a button to save those settings, when i save settings if i have like 6 maps in the gridlist after that for loop i receive : those 6 maps + one blank row ( map 1 , map 2 ... map 6 , *BLANK ) Link to comment
TAPL Posted February 5, 2014 Share Posted February 5, 2014 Try this: for i=1, guiGridListGetRowCount(maps) do And try this: for i=0, guiGridListGetRowCount(maps)-1 do Link to comment
h4x7o0r Posted February 5, 2014 Author Share Posted February 5, 2014 Now's working perfect. Thanks a lot TAPL. off: Your 5k post 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