This makes it harder to crash mods that aren't expecting malicious
formspec input.
I don't like the large amount of unit tests but I don't see how to avoid
them and arguably those tests should have been there beforehand anyway.
I've made a new naive_str_width function that tries to estimate the
width of UTF-8 text and is faster than strip_escape_sequences on LuaJIT
(I guess because there isn't an intermediate string being created).
Closes#4
Adds the `Form:set_as_inventory_for(player, [ctx])` API.
Also includes:
• `Form:unset_as_inventory_for(player)`
• Extends private `show_form` to account for inv edge cases
• Extends private `on_fs_input` to account for inv edge cases
• Adds several abstraction functions
• Add feature to `on_leaveplayer` to delete the inv formspec state as well
• Add a few unit tests for related features