Closed ThePhD closed 5 years ago
EDIT: The text that used to be here was a dumb idea that I didn't fully think through. Being tired sucks.
This drops down to the stack level no?
This is used if and only if sol::stack
doesn't already have a define and there is a viable to_lua
/from_lua
/check_lua
implementation.
This pull requests vastly simplifies the "plug in" architecture by allowing a user to define three functions to hook into the existing lua system:
int to_lua( lua_State* L, T&& item )
SomeReturn from_lua( types<T>, lua_State* L, int index )
bool check_lua( types<T>, lua_State* L, int index )
It's mostly an experimental feature, and I do not like the interface for
from_lua
andcheck_lua
, since we have to take an overload-resolving argumenttypes<T>
in order to properly SFINAE if such a function exists (and prevent ambiguous overloads if you want to write such a function for multiple types).to_lua
, however, is done quite nicely and works out pretty well (tests also pass for the branch).