lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


to run in the repl, I needed to encapsulate within do...end

do local io=io.write
local i,j,k local z,b={},{}
local a=".,-~:;=!*#$@"local A=0.0
local sin=math.sin local cos=math.cos
local int=math.floor io("\27[2J")local B=
0 while true do for i= 0,1759 do b[i]=" " z
[i]=0.0 end j=0.0 while 6.28 > j do i=0 while
6.28>i do local c=sin(i)local d=cos(j) local e=
sin(A)local f=sin(j) local g=cos(A) local
h=d+2 local D= 1/( c*h*e+f*g+5) local
l=cos(i) local m= cos(B)local n=sin
(B) t=c*h*g - f*e local x=int(40+30
* D*(l*h*m - t*n)) local y= int(12+15
* D*(l*h*n + t*m))o= int(x+80*y) local N=
int(8 *((f*e-c*d*g)*m - c*d*e - f*g - l*d*n))+1
if 22>y and y>0 and x>0 and 80>x and D > z[o]
then z[o]= D if N > 1 then b[o]= a:sub(N,N)
else b[o]=a:sub(1,1) end end i=i+0.02 end
j= j + 0.07 end io("\27[H")for k = 0,
1760 do if k%80>0.0 then io(b[k])
else io("\n") end end A= A+
0.04 B=B+0.02 end end

On Wed, Feb 23, 2022 at 7:53 AM elves <elves@cix.co.uk> wrote:
After running it on Luau, the ambiguous syntax (line 10?) is because
of the use of t as a global. Make t a local and it'll probably work.
I looked at the requirements to compile from source for LuaJit and my
lunch break is nearly over....
On 23.02.2022 12:31, Spar wrote:
> Sadly doesn't work on LuaJIT because of ambiguous syntax : )
> On 23 Feb 2022, 15:23 +0300, elves <elves@cix.co.uk>, wrote:
>
>> The C version has been recoded to avoid trig functions.
>>
>> Someone here should read the note here -
>> https://www.a1k0n.net/2021/01/13/optimizing-donut.html
>> Oh, alright I'll look.
>>
>> On 23.02.2022 01:52, Wilfred Nilsen wrote:
>>
>>>> Lua version of Andy Sloane's rotating ASCII donut
>>>
>>> Very cool, but OMG, it takes a lot of CPU :-)
>>>
>>> -Wilfred
>>
>> --
>> Get your CIX on route 109.123.97.120

--
Get your CIX on route 109.123.97.120


--
Andrew Starks
612 840 2939
andrew@starksfam.org