Use scoped Lua refs in custom entities.

With this, we can remove destructors, copy constructors and assignment
operators. ScopedLuaRef takes care of ownership.