lua-users home
lua-l archive

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


> Bogdan Marinescu wrote:
>> Thank you, I understood that. The part that I don't understand is why
>> does the string have to be fully aligned.
>
>> From the reference manual "lua_tolstring returns a fully aligned 
>> pointer to 
> a string inside the Lua state.".
>
> I imagine the reason this is guaranteed is so that strings can contain  
> binary data - structs etc.  Useful when looking up cached values in 
> tables for example, - would also allow specialised high speed string 
> functions to be written which both know the length of the string, and 
> that it's aligned.

Mostly the first reason (strings containing binary data).

-- Roberto