Jump to content
  • 0

How do I edit values separately after I save it?


zaplar

Question

Posted

Hi. I'm newbie and I'm making script and i want to know how to edit values separately in save list/how can I edit different/individual values inside of it without touching other values.

1835157886_Screenshot_2023-02-20-04-25-58-734_com.ludashi.dualspace2.thumb.jpg.e56d7e439b45ec7815b85e5f9e02cf8a.jpg

2 answers to this question

Recommended Posts

Posted

You can think of the save list like a simple table variable, you can retrieve any of the values in it using their index, or if you named them you can filter the table and match value name

Example 1: Edit by index (Position in the list)

local v = gg.getListItems()[1]
v.value = 0

gg.addListItems({ v })

 

Example 2: in case you set the name field in your value

for k, v in pairs(gg.getListItems()) do
  if v.name == "Health" then
    v.value = 0
    break -- if you want to stop at the first match
  end
end
gg.addListItems({ v })

Check getListItems()


for your sepecial case you can do this

gg.loadResults(gg.getListItems())
gg.getResults(2)
gg.editAll("0;2", gg.TYPE_FLOAT)

 

Posted
Just now, zaplar said:

Hi. I'm newbie and I'm making script and i want to know how to edit values separately in save list/how can I edit different/individual values inside of it without touching other values.

1835157886_Screenshot_2023-02-20-04-25-58-734_com.ludashi.dualspace2.thumb.jpg.e56d7e439b45ec7815b85e5f9e02cf8a.jpg

example:

I want to change the first value to 0

second value 2

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.