View previous topic :: View next topic |
Author |
Message |
Akiros Newbie cheater Reputation: 0
Joined: 11 Apr 2020 Posts: 24 Location: my house
|
Posted: Sun Jul 31, 2022 8:05 am Post subject: Turn list of codes into table ? |
|
|
Hello, I need help on how to make a list of codes into a table.
I have a long list in this format
A20
A29
B12
B40
C94
C34
D30
D14
E05
E94
I would like to know how to turn this list into a table with having to put "", after each one _________________
help pls im noob |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Sun Jul 31, 2022 9:29 am Post subject: |
|
|
Code: | myList = [[A20
A29
B12
B40
C94
C34
D30
D14
E05
E94]]
myTbl = {}
function addTblItems(tbl,list)
sl = createStringlist()
sl.Text = list
for i=0, sl.Count - 1 do
a = sl[i]
tbl[i+1] = [["]] .. a .. [["]]
end
sl.Destroy()
end
addTblItems(myTbl,myList)
--print tbl result
for i,k in pairs(myTbl) do
print(k)
end |
result:
"A20"
"A29"
"B12"
"B40"
"C94"
"C34"
"D30"
"D14"
"E05"
"E94" _________________
|
|
Back to top |
|
|
Akiros Newbie cheater Reputation: 0
Joined: 11 Apr 2020 Posts: 24 Location: my house
|
Posted: Sun Jul 31, 2022 10:11 am Post subject: |
|
|
Thank you ! this is what i look for _________________
help pls im noob |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Sun Jul 31, 2022 10:32 am Post subject: |
|
|
If you want to load it into a table, you don't need the quotes frame.
Create your list (myList=[[]]) and import your list into the table with this function.
Code: | function addTblItems(tbl,list)
sl = createStringlist()
sl.Text = list
for i=0, sl.Count - 1 do
a = sl[i]
tbl[i+1] = a --[["]] .. a .. [["]]
end
sl.Destroy()
end
addTblItems(myTbl,myList
print(myTbl[3]) -- > B12
|
_________________
|
|
Back to top |
|
|
|