[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: writable "string" ?
- From: Eike Decker <eike@...>
- Date: Thu, 1 Mar 2007 12:21:51 +0100
Hi
Lua calculates a hash value for strings in order to improve the speed for
comparing two strings. If you change the string inside of C, the hash value
won't be valid anymore. The hashvalue is used for comparing strings or storing
strings in tables as keys (as far as I know).
You could also write a C userdata object that allows you to create a buffer that
you can manipulate. Of course this would require you to write your own functions
to search patterns and so on, so this would be quite some work...
Eike
> Hi,
>
> I want to implement some file buffering system which
> can range from say 32K to 512K and the read/write
> pattern is typical like write(f, offset, size) where
> the size is usually 4k to 16k, or may be even smaller.
>
> It seems that keeps on re-constructing the string
> would be very in-efficient, so is using a table to
> store individual char(as string or number).
>
> I want to just write a simple C function which takes
> the passed in "lua string" and use memcpy to overwrite
> the desired range.
>
> Is this doable or are their any concern ?
>
> thanks and regards,
>
> gary
>
>
>
>
____________________________________________________________________________________
> Never Miss an Email
> Stay connected with Yahoo! Mail on your mobile. Get started!
> http://mobile.yahoo.com/services?promote=mail
>