[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Printing strings
- From: "Patrick Donnelly" <batrick.donnelly@...>
- Date: Wed, 2 Jul 2008 15:03:28 -0600
On Wed, Jul 2, 2008 at 3:00 PM, Peter LaDow <email@example.com> wrote:
> Thanks to everyone for their help earlier with the side effects. The
> sandbox approach will work for me.
> Now on to the next issue. Can somebody explain why I get different
> results using print with the concatenation operators and using the
> strings as separate arguments. I presume it has something to do with
> calls to tostring(), but it isn't clear.
> For example, assume key hold "hello" and value holds "world". Doing this:
> print("'", key, "' = '", value, "'")
> I get:
> ' hello ' = ' world '
> And doing:
> print("'" .. key .. "' = '" .. value .. "'")
> I get:
> 'hello' = 'world'
> Where do the extra spaces come from in the former case?
Lua adds a tab character between arguments to print, and a newline
after printing all arguments.
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."