mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
make safe usertypes safer (nw)
This commit is contained in:
parent
55b5777824
commit
6fd9586a89
3
3rdparty/sol2/sol/call.hpp
vendored
3
3rdparty/sol2/sol/call.hpp
vendored
@ -276,6 +276,9 @@ namespace sol {
|
|||||||
static int call(lua_State* L, Fx&& f) {
|
static int call(lua_State* L, Fx&& f) {
|
||||||
typedef std::conditional_t<std::is_void<T>::value, object_type, T> Ta;
|
typedef std::conditional_t<std::is_void<T>::value, object_type, T> Ta;
|
||||||
#ifdef SOL_SAFE_USERTYPE
|
#ifdef SOL_SAFE_USERTYPE
|
||||||
|
if(type_of(L, 1) != sol::type::userdata) {
|
||||||
|
return luaL_error(L, "sol: received null for 'self' argument (use ':' for accessing member functions, make sure member variables are preceeded by the actual object with '.' syntax)");
|
||||||
|
}
|
||||||
object_type* o = static_cast<object_type*>(stack::get<Ta*>(L, 1));
|
object_type* o = static_cast<object_type*>(stack::get<Ta*>(L, 1));
|
||||||
if (o == nullptr) {
|
if (o == nullptr) {
|
||||||
return luaL_error(L, "sol: received null for 'self' argument (use ':' for accessing member functions, make sure member variables are preceeded by the actual object with '.' syntax)");
|
return luaL_error(L, "sol: received null for 'self' argument (use ':' for accessing member functions, make sure member variables are preceeded by the actual object with '.' syntax)");
|
||||||
|
Loading…
Reference in New Issue
Block a user