lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I wanted such thingy for a long time too. It can be useful to build binary files too.

Eike Decker wrote:
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).

I understand that Gary don't plan to use this string in Lua, this is probably to dump to file at the end, or hand it to some library, etc.

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...

Yes, it is probably the way to go. It can even have a toString function to convert it to Lua string... Not hard to do, but some work indeed, that's why I never started this project... :-) I vaguely recall somebody in this list announcing a similar library, it might be worth doing a little search...

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --