Question

I have the command:

string.format("movel(p[0.%d,- 0.%d, 0.%d, -0.5121, -3.08, 0.0005])"+ "\n", averageX1, averageY1, averageY2 )

Where average value can change from 0 to 700. When the value is

averageX1 = 344
averageY1 = 222
averageY2 = 150

The command becomes:

movel(p[0.344,- 0.222, 0150, -0.5121, -3.08, 0.0005])

When one of the average becomes lower then 100:

averageX1 = 80

The command becomes

movel(p[0.**80**,- 0.222, 0150, -0.5121, -3.08, 0.0005])

I want it to become :

movel(p[0.**080**,- 0.222, 0150, -0.5121, -3.08, 0.0005]

How can I change this so it will have the value that can be from 0 tot 100.

ps. It is the "0" that must be in front of the "8".

kind regards pascal

Was it helpful?

Solution

Change 0.%d to 0.%03d. Also see here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top