The key value returned by lua_next, on the Lua stack, cannot be modified.
Certain tests such as lua_isstring will convert the value.
The solution is, instead of testing if they key can be converted to a string, test if it actually is a string by using lua_type.
This allows the variant_callable to store a shared_ptr to its callable while ensuring that
callables that were allocated on the stack or as part of a larger structure are not
double-freed.
Includes a few minor syntax changes such as range-for deployment.
Also moves the implementation of formula_callable::get_value and various map_formula_callable functions to their
appropriate places.
Since there are some issues with deploying shared_ptr fully and it has not yet been done, there's the possibility
of pointers being freed twice. The raw pointer implementation results in memory leaks, but at least it should
suffice until full smart pointer support can be added.
This splits the handling of each applicable type into its own helper class to better encapsulate the functionality of each.
It also contains a lot of related cleanup and improvements to the class interface itself.
Lua deprecated luaL_typerror. Wesnoth needs it. Traditionally this was handled as a by-hand edit to the Lua source kit. Refactored into Wesnoth as luaW_type_error.
This constitutes drop-in replacements for:
* boost::shared_ptr
* boost::scoped_ptr
* boost::weak_ptr
* boost::enable_shared_from_this
* boost::static_pointer_cast
* boost::dynamic_pointer_cast
This excludes boost::intrusive_ptr, except for stray includes. Refactoring that is more complicated.