lua-users home
lua-l archive

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


> I see one possible major problem with a simple implemetation of the
> level one API. Does it enable crashing the application?

No if it's done carefully. See my libraries for examples. It's easy, really:
you just wrap pointers as userdata and set them to NULL when they're GC'd or
destroyed and check for NULL when they're handed to C.

On the other hand, I've found that it's simpler to bind destroy functions
to __gc methods instead of exporting them to Lua.

Bottom line: Lua has all the mechanism to allow writing bindings that cannot
crash the application. Lua libraries written in C should use them.
--lhf