lua-users home
lua-l archive

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

> On Jul 8, 2015, at 2:36 PM, Philipp Janda <> wrote:
> Have you ever wondered why strings aren't implemented as userdata (given Lua's minimalistic nature)? Both are essentially sequences of bytes, after all.
>> -Andrew
> Philipp

Different visibility. A userdata cannot be mutated by Lua code, only C code (the exception being it can be GCed, but even then C code can be informed of this via __gc). This allows a C library to offload storage of state to Lua but still be assured coherence of that state.