lua-users home
lua-l archive

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


2015-05-23 14:28 GMT+02:00 Александр Машин <alex.mashin@gmail.com>:

> is it possible to save a compiled LPeg grammar or pattern to file or
> database and then to load it thence by means of pure Lua?

No.

> Effectively it means whether I can cast userdata to string and string to
> userdata correctly.

A userdata is a black box of memory that can only be accessed by
C routines. Even if you cast its memory block to a C string and push
that C string onto the stack as a return value, the Lua string will refer
to a newly created copy owned by Lua, not to the original string pointer.