[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua in Javascript environments [was: iLuaBox Now Available - Run Lua on Your iPad]
- From: Jonathan Castello <twisolar@...>
- Date: Tue, 26 Oct 2010 13:14:06 -0700
On Tue, Oct 26, 2010 at 1:08 PM, Duncan Cross <duncan.cross@gmail.com> wrote:
> On Tue, Oct 26, 2010 at 8:43 PM, Jonathan Castello <twisolar@gmail.com> wrote:
>> I was under the impression that UTF-8, which Javascript strings use,
>> puts restrictions on certain bytes. From Wikipedia's page for UTF-8,
>> bytes above 127 are either part of a sequence, or are reserved.
>
> Javascript code only "sees" strings as a sequence of Unicode
> characters, the internal representation of those characters in memory
> (UTF-8 or otherwise) is hidden and inaccessible. U+0000 through to
> U+00FF are all valid Unicode characters, so it's certainly possible to
> use a Javascript string to store a sequence of arbitrary octets, but
> they will be taking up more space in memory than just that number of
> bytes.
>
> -Duncan
I don't think the raw output from `luac` - which Matthew's project
currently uses (if I'm wrong please correct me) - is valid UTF-8, so
there would need to be a separate step to encode the raw bytes in
UTF-8 before the server sends them. If that works, though, it wouldn't
be very different in nature from the packed-image idea, and it doesn't
sound too hard to do...
~Jonathan