lua-users home
lua-l archive

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


On Mon, Oct 31, 2011 at 17:27, Matthew Wild <mwild1@gmail.com> wrote:
> (function () {
>
> On 31 October 2011 22:59, Gavin Wraith <gavin@wra1th.plus.com> wrote:
>> It had somehow never hit home to me that the top level of a Lua program
>> is a chunk. Because of this I had been enclosing my programs within
>> do ... end structures so that I could use local variables at the top level
>
>> I expect all this is not news to seasoned Lua users, but I thought the
>> disassembly listings might entertain.
>
> I still remember the moment I realised (with a groan) that "var foo =
> true" in the top level of a Javascript script had visibility
> throughout the current environment. Sigh.
>
> Regards,
> Matthew
>
> })()
>
>

Javascript then does some interesting things like hoisting to confuse
you further. ;-)

One of my first attempts to write a program was in assembly (ha!). It
was intended to be a simple countdown timer. All it did was decrement
EAX a few times. It hadn't occurred to me that I had to do more things
to actually display that number on the screen, nor that without a
delay my 10-second countdown would be closer to a 10-microsecond
countdown...

I ended up learning most of what I know about computers by hacking and
studying Nintendo 64 games, so I can vouch for how helpful it can be
to read bytecode/machine code.

-- 
Sent from my toaster.