[Solved] Lua tables and screen coordinates. For every {x} at y do


Is this at all possible or am I reaching beyond the language capabilities?

Not even close. I recommend you read Programming in Lua.

 tap({xTable}, y)   

But I’m not sure if that will “tap” at each x coordinate that I’ve listed for the y variable.

Why are you not sure? Did you not write it? If not, you can trivially write it yourself given tap:

function tapxs(xs, y)
    for i,x in ipairs(xs) do
        tap(x,y)
    end
end

tapxs({10,20,30,40}, 10) -- tap at 10,10; 20,10; 30,10; etc.

I want to paint a pixel at one very specific coordinate, and then step 5 pixels away and paint the next one, and repeat that until the end of the line.

What is “the line”? Is it purely horizontal? You could write:

function tapHorizontally(startX, maxX, y, increment)
    for x=startX,maxX,increment do
        tap(x,y)
    end
end

tapHorizontally(10,100,20,5) -- tap from 10,20 to 100,20 in 5 pixel increments

Of course, that’s a bizarrely specific function. You’d typically write something that takes a starting x,y and ending x,y and draws between them, so you can support horizontal, vertical, diagonal lines all with the same function, but that requires more math.

The bottom line is: Lua is a full blown, powerful, high level programming language. It could be used to write the very app you’re tapping on, or the app you’re using to generate taps, so the limits are going to be your knowledge of programming/algorithms/math/etc.

1

solved Lua tables and screen coordinates. For every {x} at y do