Assuming a regular polygon can always fit inside of a circle perfectly, you just have to use sin and cosine and do the points with 360/n and multiply by a length found using the side length of the polygon. I may be wrong, though.

[editline]02:14AM[/editline]

Example code, not tested.

[lua]

local coords = {}; // Table of coordinates

local n = 5; // Number of points

local len = 50; // Length of sides

local originX = 0; // X Origin of polygon

local originY = 0; // Y Origin of polygon

local radius = len / (2 * math.sin(math.pi/n));

for i=1,n do

```
local x = originX + (math.cos(math.Deg2Rad((360/n)*i)) * radius);
local y = originY + (math.sin(math.Deg2Rad((360/n)*i)) * radius);
table.insert(coords, {x, y});
```

end

[/lua]

[editline]02:20AM[/editline]

After rereading your post, if you want it to be the size of a square, just change the radius to half of the length of your square.