Currently, the amount of memory allocated for a map can sometimes be
different depending on whether it was allocated with an initial capacity
or the items were added iteratively.
This causes problems for people that want to copy data between maps that
have the same number of elements.
Now, the size of a map will always be the same for a given number of
elements, regardless of how the elements are added.
Plus this gets rid of the weird prevpo2 function. Yay.
Now Ref has a type id instead of a destructor/name, and use the type to
lookup the destructor and name when needed.
This improves performance, since now Ref contains a lot less data and we
can do an integer comparison instead of a string comparison when reading
objects from Lua.
Some more questions:
- Should there be some kind of allocation helper so you don't need
to always check the result?
- Throwing an error on OOM is convenient and is probably correct 90%
of the time, it even provides a nice error message instead of a
nil dereference somewhere. But it's inflexible. Is it the right
thing to do?
There are breaking changes:
- lovr.step is removed.
- lovr.run is expected to return a main loop wrapped in a function. The
returned function is run as a coroutine to facilitate a cooperative
main loop.
- lovr.errhand should return a loop function instead of while true-ing.