mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix semantics of check_get for objects obtained by proxy
This commit is contained in:
parent
e8e5ddc890
commit
e8119ec9a3
@ -77,5 +77,6 @@ int main(int, char**) {
|
||||
|
||||
lua.script("check_f_env(f)");
|
||||
lua.script("check_g_env(g)");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ namespace stack {
|
||||
template <typename Handler>
|
||||
static optional<T> get(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
// actually check if it's none here, otherwise
|
||||
// we'll have a nil object inside an optional!
|
||||
bool success = !lua_isnoneornil(L, index);
|
||||
// we'll have a none object inside an optional!
|
||||
bool success = !lua_isnone(L, index);
|
||||
if (!success) {
|
||||
// expected type, actual type
|
||||
tracking.use(static_cast<int>(!lua_isnone(L, index)));
|
||||
tracking.use(static_cast<int>(success));
|
||||
handler(L, index, type::poly, type_of(L, index), "");
|
||||
return nullopt;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user