ivansafrin/Polycode — pull request #151 by mcclure (2013-02-17 00:33:27+00:00)
Title: Make delete() safe to use

Things that don't work in Lua currently:

- Calling delete(nil) in Lua. (Exception.)
- Calling delete() twice. (Crashes.)
- Calling delete() on an object which will be handled by the __gc finalizer. (Crashes.)

Address these things by adding a nil check to lua delete() and having the C delete helper nil out the pointer-pointer after deleting it.