gre.poly string

gre.poly_string(
    x_values,
    y_values
)
  or
gre.poly_string(
    {{x=, y=}, ...}
)
            

This is a higher performance function for generating a polygon string based on a set of numeric data points maintained in Lua table arrays.

In the two argument form, the function receives as inputs two Lua tables whose content represents the numeric x and y data points to be converted to a string. The tables are 1 based arrays and must be of the same length.

In the single argument form, the function receives as input a single Lua table whose array content are tables with an "x" and "y" member value.

The string returned is designed to be compatible with the Storyboard polygon plugin and is in the form of X1:Y1 X1:Y2 ...

Parameters: x_values, y_values An table containing numeric data for the x and y points respectively. {{x=, y=}} A table containing tables with x and y members specifying the x and y points. Example:

-- Create a triangle polygon in a 100x100 square
local x_points = { 0, 50, 100 }         -- Left, Middle, Right
local y_points = { 100, 0, 100 }        -- Bottom, Top, Bottom
local x_y_string = gre.poly_string(x_points, y_points)
print("X Y String: " .. x_y_string)

-- Create the same triangle, but with x,y member variables
local xy_points = { {x=0,y=100}, {x=50,y=0}, {x=100,y=100} }
local xy_string = gre.poly_string(xy_points)
print("XY String: " .. xy_string)
                
Was this article helpful?
0 out of 0 found this helpful