Help!!!

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help!!!

konthiga Lee
First of all, i'm sorry to write this letter to you beacause the question i want to ask maybe is not your responsibility.I have googled for thousands of pages to find out the difference between semicolon and comma in lua,but none of the results answer clearly,will you please do me a favour to show me the very answer: Is there any difference between semicolon and comma in lua?when should i use a comma and when shuold i use a semicolon?

If this semantic question is not your filed, please show me where i can find lua users to ask me.

Thanks a lot :)
Reply | Threaded
Open this post in threaded view
|

Re: Help!!!

Michael Broughton
Just to clarify, do you mean within a table constructor? If that is the
case, you can use either or both.

Mike



konthiga Lee wrote:

> First of all, i'm sorry to write this letter to you beacause the
> question i want to ask maybe is not your responsibility.I have googled
> for thousands of pages to find out the difference between semicolon
> and comma in lua,but none of the results answer clearly,will you
> please do me a favour to show me the very answer: Is there any
> difference between semicolon and comma in lua?when should i use a
> comma and when shuold i use a semicolon?
>
> If this semantic question is not your filed, please show me where i
> can find lua users to ask me.
>
> Thanks a lot :)
Reply | Threaded
Open this post in threaded view
|

Re: Help!!!

Ben Sunshine-Hill
In reply to this post by konthiga Lee
The semicolon is used in two places. First, it is an alternative to
the comma in table constructors. There is no difference between it and
the comma there. Secondly, it can be used to delineate the end of
statements, although it isn't required.

Ben

On 5/4/06, konthiga Lee <[hidden email]> wrote:

> First of all, i'm sorry to write this letter to you beacause the question i
> want to ask maybe is not your responsibility.I have googled for thousands of
> pages to find out the difference between semicolon and comma in lua,but none
> of the results answer clearly,will you please do me a favour to show me the
> very answer: Is there any difference between semicolon and comma in lua?when
> should i use a comma and when shuold i use a semicolon?
>
> If this semantic question is not your filed, please show me where i can find
> lua users to ask me.
>
> Thanks a lot :)
>
Reply | Threaded
Open this post in threaded view
|

Re: Help!!!

David Jones-2
In reply to this post by konthiga Lee

On May 05, 2006, at 05:25, konthiga Lee wrote:

> First of all, i'm sorry to write this letter to you beacause the
> question i want to ask maybe is not your responsibility.I have googled
> for thousands of pages to find out the difference between semicolon
> and comma  in lua,but none of the results answer clearly,will you
> please do me a favour to show me the very answer: Is there any
> difference between semicolon and comma in lua?when should i use a
> comma and when shuold i use a semicolon?
>
> If this semantic question is not your filed, please show me where i
> can find lua users to ask me.

Always use comma, never use semicolon.

A comma is used to separate arguments in function calls
f(a, b, c)

And in multiple variable assignment:
a, b, c, = 1, 2, 3

And in multiple returns:
return a, b, c, f(a, b, c)

A semicolon is used at the end of statements, but it's entirely
optional.  Almost no-one uses it routinely.

drj