Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Turn list of codes into table ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Akiros
Newbie cheater
Reputation: 0

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Sun Jul 31, 2022 8:05 am    Post subject: Turn list of codes into table ? Reply with quote

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 Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1260

PostPosted: Sun Jul 31, 2022 9:29 am    Post subject: Reply with quote

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"

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Akiros
Newbie cheater
Reputation: 0

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Sun Jul 31, 2022 10:11 am    Post subject: Reply with quote

Thank you ! this is what i look for
_________________
help pls im noob Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1260

PostPosted: Sun Jul 31, 2022 10:32 am    Post subject: Reply with quote

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

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites