lua-users home
lua-l archive

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

----- Original Message -----
From: <>
To: Multiple recipients of list <>
Sent: Monday, August 28, 2000 4:30 PM
Subject: Re: Re: Antwort: global keyword instead of local

> Erm... could you be a little bit more verbose? O don't know python... What
> do I see here? I understand the function definition, but what about the
> stack trace?

Oh -- sorry about that... :))

Function definition:

def f():
    i = i+1

Now, we define a global variable:

i = 1

If we now try to call f(), we will get an error, since i does not
exist in the local namespace of f. That's all. If we wanted f()
to work, we would have to write:

def f():
    global i
    i = i+1

Quite the opposite of Lua, I guess. :)


  Magnus Lie Hetland      (magnus at hetland dot org)

 "Reality is what refuses to disappear when you stop
  believing in it"                 -- Philip K. Dick