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 


Cheat Engine Forum Index
PostGo back to topic
FreeER
Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun Mar 04, 2018 6:09 am    Post subject:

Code:
for i = 0,i<count-1, i+1 do
this is not how lua for loops work Smile
Code:
for i=0,list1.Count-1 -- or count-1 if stored, optionally with ",1" at the end to explicitly show that it's i=i+1


Second, Selected is an array of booleans on the listbox (and yeah, that's how Pascal/Lazarus TListBox works...), .Items[whatever] is just a string because Items gives you access to the underlying stringlist of items. So a working example:

Code:
if not UDF1 or false then
  UDF1 = createForm()

  list1 = createListBox(UDF1)
  list1.Items.setText("1\n2\n3\n4\n")
  list1.MultiSelect = true
  list2 = createListBox(UDF1)
  list2.Top = list1.Height
end

count = list1.Items.Count

for i = 0,count-1 do
 if list1.Selected[i] then
  list2.items.Add(list1.items[i])
 else
   --print(list1.Items[i],'not selected')
 end
end

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
Corroder
Review: Approve
Post reference:
ReviewPosted: Mon Mar 05, 2018 10:53 pm


Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites