lua-users home
lua-l archive

Why does lua interpreter need = in front of variables?

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


I am learning lua after using python for the last few years.
In the lua toplevel, why do I either have to either put a "=" in front
of a variable?
In python, the toplevel evaluates everything automatically:
 $ python
 Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
 >>> 1 + 1
 2
 >>>
 $ lua
 Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
 > 1 + 1
 stdin:1: unexpected symbol near '1'
 > = 1 + 1
 2
 >
I started thinking about this, and I wondered if maybe the "=" forces
the toplevel to evaluate the object.
I'm just curious, but this detail stumps me.
Thanks in advance.
Matt

AltStyle によって変換されたページ (->オリジナル) /