[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: string.byte with empty string
From:       Duncan Cross <duncan.cross () gmail ! com>
Date:       2009-01-27 11:52:26
Message-ID: db3aeaf60901270352mbf74de4t34c20e3a41db0d0d () mail ! gmail ! com
[Download RAW message or body]

On Tue, Jan 27, 2009 at 2:56 AM, Vaughan McAlley <ockegheim@gmail.com>wrote:

> > If you're just testing a single character at the start, comparing to
> > string.sub(s,1,1) - or s:sub(1,1) - seems like a more obvious route to
> take.
> >
> > -Duncan
> >
>
> My original intention was to test the string without creating a new
> string. Pretty trivial, I know, in the grand scheme of things :-)
>
> Vaughan
>

Ah right. (You're not quite creating a new string - strings with the same
value only exist once in Lua - but there's probably slight overhead, sure.)

-Duncan

[Attachment #3 (text/html)]

<div class="gmail_quote">On Tue, Jan 27, 2009 at 2:56 AM, Vaughan McAlley <span \
dir="ltr">&lt;<a href="mailto:ockegheim@gmail.com">ockegheim@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div class="Ih2E3d">&gt; If \
you&#39;re just testing a single character at the start, comparing to<br> &gt; \
string.sub(s,1,1) - or s:sub(1,1) - seems like a more obvious route to take.<br> \
&gt;<br> &gt; -Duncan<br>
&gt;<br>
<br>
</div>My original intention was to test the string without creating a new<br>
string. Pretty trivial, I know, in the grand scheme of things :-)<br>
<font color="#888888"><br>
Vaughan<br>
</font></blockquote></div><br>Ah right. (You&#39;re not quite creating a new string - \
strings with the same value only exist once in Lua - but there&#39;s probably slight \
overhead, sure.)<br><br>-Duncan<br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic