[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua-l Digest, Vol 28, Issue 37
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sat, 17 Nov 2012 14:16:49 +0200
2012/11/17 David Favro <lua@meta-dynamic.com>:
> On 11/17/2012 03:47 AM, Dirk Laurie wrote:
>>
>> Lua has no variables (i.e. preallocated named blocks of memory
>> the contents of which may change)
>
> Except for local variables, including function parameters, for-loop
> variables, etc.
>
You're right. Indeed, those correspond closely to the definition
in parentheses.
For function parameters, even I might support C-like syntactic sugar:
function myfunc (number a, string b, table c)
if only because most of my functions start off something like
if type(a)~="number" then error(
"Bad parameter #1to myfunc: number expected, got "..type(a))
The semantics would be that if there are two whitespace-separated
names, the appropriate argument check is made (the API already
has the necessary routines), otherwise it's business as usual.