View Single Post
Old 01-10-2019, 01:41 AM   #18
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Quote:
Originally Posted by cfillion View Post
tpool = {} replaces the table with a new empty one every time. Move that to your initialization code (where number = 0 is) so that it's run only once (or whenever you want to clear all stored values).
Ah, good to know. Many thanks.

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++

That was it! Yeah, now it works.

Now I only need to know how to place a "," separator only every second output in concat.
But I guess it would be easier to remove the last unwanted "," from the whole final string with something like that.
Code:
table.insert(tpool, timeString)
        finalString = table.concat( tpool )
        finalString = finalString:sub(1, -2)
        w2:set_text(finalString)
        save_to_clipboard(finalString)
        number = number + 1
Okay, it works but I don't know why because it also cuts the last sign of the A timestamp but inserts it back if I add the B timestamp. Strange. But exactly what I wanted.

EDIT: Now I know what happens. The string gets cut after the table so every time the concat occurs it will load the whole string without cut. That fits perfectly to my needs. Awesome!

Last edited by Eliseat; 01-10-2019 at 02:45 AM.
Eliseat is offline   Reply With Quote