Jump to content
  • 0

Add to value, do not replace in a table


Question

Posted

Hi,

I've been trying to figure this out, but is it possible to add to a value, do not replace in a table?

gg.searchNumber("7;100;7000;60", gg.TYPE_FLOAT)
local t = gg.getResults(4)
t[1].value = '9E9'
t[2].value = '-3.4E38' --I want to add to value, do not replace--
t[3].value = '50000'
t[4].value = '3.4E38' --I want to add to value, do not replace--
gg.setValues(t)
gg.clearResults()

Thanks!

2 answers to this question

Recommended Posts

  • 0
Posted (edited)
24 minutes ago, Purrssian said:

Hi,

I've been trying to figure this out, but is it possible to add to a value, do not replace in a table?

gg.searchNumber("7;100;7000;60", gg.TYPE_FLOAT)
local t = gg.getResults(4)
t[1].value = '9E9'
t[2].value = '-3.4E38' --I want to add to value, do not replace--
t[3].value = '50000'
t[4].value = '3.4E38' --I want to add to value, do not replace--
gg.setValues(t)
gg.clearResults()

Thanks!

you can use this

table.insert(t, "-3.4E38") -- but it will add it in the end of the table !
-- if you want to add it in index 2 without replacing it you can use this 
table.insert(t, 2,"-3.4E38") --it will add it as index 2 and it will make the old index 2 to 3 etc

 

Edited by MANDO01

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.