Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hand positions in a circle
--lua 5.3 print ("Hello, World!") local colors = {"Blue", "Brown", "Green", "Orange", "Pink", "Purple", "Red", "Teal", "White", "Yellow"} local heading = 18 --initial heading. We're going clockwise from the top-most point, so 90+(36/2) local sin = math.sin local cos = math.cos local rad = math.rad local radius = 50 local positions = {} for k,v in ipairs(colors) do positions[v] = { x = sin(rad(heading))*radius, z = cos(rad(heading))*radius, h = heading, } heading = heading + 36 end for k,v in pairs(positions) do local str = [[ { "Color": "]]..k..[[", "Transform": { "posX": ]]..v.x..[[, "posY": 3.5, "posZ": ]]..v.z..[[, "rotX": 0.0, "rotY": ]]..(v.h+180)..[[, "rotZ": 0.0, "scaleX": 16.0, "scaleY": 10.0, "scaleZ": 8.0 } }, ]] print(str) end local
run
|
edit
|
history
|
help
0
roulette
Word by Word string partition in Lua
VERSION
Dirty Bag 'o Tokens Maker
Security keygen
10 Line challenge
Visala Test
Show current system clock
Lua recursion with function
Frequency distribution of rolling a certain number on xDy