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 


ListView and Table

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Apr 03, 2019 12:07 am    Post subject: ListView and Table Reply with quote

Hi there,

say I have a CEListView with 3 Columns:

To add an item to CEListView:

Code:
function addHackItem(sender, listitem)
-- hack_table = {}
 game_name = edtGame.Text
 url_name = urlGame.Text
 last_update = os.date("%d.%m.%Y")
 local  list = plist
 local items = list.Items
 local item = items.Add()
 item.Caption = game_name
 item.SubItems.text = url_name.."\n"..tostring(last_update)
end


Next, I have a table, said as hack_table.

Code:
 hack_table = {}


Now need samples for:

1. How to save or add an item or all items to my table from ListView item(s) with the following format: {game_name,url_name,last_update} ?

2. Say my table contains some fields with items: {game_name,url_name,last_update},{game_name,url_name,last_update} and so on then how add that to my list view?. Note : Table were saved on local disk with name : blablabla.lua

3. Event handler: when double click an item on listview (selected index), how to get only url_name as a variable?

Thanks


EDIT #1 :
1. Add item to the table directly from variables [SOLVED]:

Code:
hack_table = {}

table.insert(hack_table,{name =game_name, url = url_name, ls_update = last_update"})
table.sort(hack_table, function(x,y) return x.name < y.name end)
for _,hack_table in ipairs(hack_table) do print(hack_table.name, hack_table.url, hack_table.ls_update) end


EDIT #2 :
3. Event handler: when double click an item on listview (selected index), how to get only url_name as a variable?

with this code :

Code:
game = list.Items[list.ItemIndex+1].Caption
url = list.Items[list.ItemIndex+1].SubItems[0]
lsupdate =l ist.Items[list.ItemIndex+1].SubItems[1]

print(game..','..url..','..lsupdate)
table.insert(hack_table,{game_name = game, ur_namel = url, last_update = lsupdate})


So, with the code above, I am able to handle all variables/elements that I need. Case closed.
Anyhow, thanks for attention if any.
Razz

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
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