User:Hajo/test1
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Table-test
10x10
__ | AA | BB | CC | DD | EE | FF | GG | HH | II | JJ |
---|---|---|---|---|---|---|---|---|---|---|
:: | a1 | b1 | c1 | d1 | e1 | f1 | g1 | h1 | i1 | j1 |
:: | a2 | b2 | c2 | d2 | e2 | f2 | g2 | h2 | i2 | j2 |
:: | a3 | b3 | c3 | d3 | e3 | f3 | g3 | h3 | i3 | j3 |
:: | d4 | d1 | d1 | d1 | d1 | d1 | d1 | d1 | d1 | d4 |
:: | e5 | e1 | e1 | e1 | e1 | e1 | e1 | e1 | e1 | e5 |
:: | f6 | f1 | f1 | f1 | f1 | f1 | f1 | f1 | f1 | f6 |
:: | g7 | g1 | g1 | g1 | g1 | g1 | g1 | g1 | g1 | g7 |
:: | h8 | h1 | h1 | h1 | h1 | h1 | h1 | h1 | h1 | h8 |
:: | i9 | i1 | i1 | i1 | i1 | i1 | i1 | i1 | i1 | i9 |
:: | j0 | j1 | j1 | j1 | j1 | j1 | j1 | j1 | j1 | j0 |
Lua - Online-IDEs
Example - Formatting a table:
Prog1
for y = -200, 200, 20 do
for x = -200, 200, 20 do
print(x,y)
end
end
Prog2
n1,n2,step=-200, 200, 50
n1,n2,step=-150, 150, 50
print("===Table===")
for y = n1,n2,step do
--print(y..": ")
s=string.format("y=%4d : ",y)
for x = n1,n2,step do
s = s..string.format("%4d,%4d ", x,y)
--print(x,y)
end
print(s); s=""
end
print("--")
Output
===Table=== y=-150 : -150,-150 -100,-150 -50,-150 0,-150 50,-150 100,-150 150,-150 y=-100 : -150,-100 -100,-100 -50,-100 0,-100 50,-100 100,-100 150,-100 y= -50 : -150, -50 -100, -50 -50, -50 0, -50 50, -50 100, -50 150, -50 y= 0 : -150, 0 -100, 0 -50, 0 0, 0 50, 0 100, 0 150, 0 y= 50 : -150, 50 -100, 50 -50, 50 0, 50 50, 50 100, 50 150, 50 y= 100 : -150, 100 -100, 100 -50, 100 0, 100 50, 100 100, 100 150, 100 y= 150 : -150, 150 -100, 150 -50, 150 0, 150 50, 150 100, 150 150, 150 --
Prog3
Task: formatting a table for the wiki
Wiki-Table
Y \ X | x=-100 | x=-50 | x=0 | X=50 | x=100 |
---|---|---|---|---|---|
y=-150 : | -100,-150 | -50,-150 | 0,-150 | 50,-150 | 100,-150 |
y= 0 : | -100, 0 | -50, 0 | 0, 0 | +50, 0 | 100, 0 |
y= 150 : | -100, 150 | -50, 150 | 0, 150 | +50, 150 | +100, 150 |
Code
--n1,n2,step=-200, 200, 50
n1,n2,step=-150, 150, 50
print('{| class="wikitable"')
--
print('|-\n! X,Y !! ...')
--
for y = n1,n2,step do
s=string.format("|-\n| y=%4d : ",y)
for x = n1,n2,step do
s = s..string.format("|| %4d,%4d ", x,y)
end
print(s); s=""
end
print("|}")
Output
X,Y | ... | ||||||
---|---|---|---|---|---|---|---|
y=-150 : | -150,-150 | -100,-150 | -50,-150 | 0,-150 | 50,-150 | 100,-150 | 150,-150 |
y=-100 : | -150,-100 | -100,-100 | -50,-100 | 0,-100 | 50,-100 | 100,-100 | 150,-100 |
y= -50 : | -150, -50 | -100, -50 | -50, -50 | 0, -50 | 50, -50 | 100, -50 | 150, -50 |
y= 0 : | -150, 0 | -100, 0 | -50, 0 | 0, 0 | 50, 0 | 100, 0 | 150, 0 |
y= 50 : | -150, 50 | -100, 50 | -50, 50 | 0, 50 | 50, 50 | 100, 50 | 150, 50 |
y= 100 : | -150, 100 | -100, 100 | -50, 100 | 0, 100 | 50, 100 | 100, 100 | 150, 100 |
y= 150 : | -150, 150 | -100, 150 | -50, 150 | 0, 150 | 50, 150 | 100, 150 | 150, 150 |