sol2/tests/regression_tests/simple/source/1095 - raw_get from global table fails.cpp
ThePhD b9115623b2
Overhaul stack_field tableless handlers
- Ensure stack field_get/field_set has consistent metaprogramming for needing a pushed table, and at what offset
- Avoid duplicate logic in table_core for the same logic by deferring to detail helper
- Fixes #1095
2020-12-29 21:50:16 -05:00

20 lines
395 B
C++

#include <sol/sol.hpp>
#include <iostream>
#include <string>
unsigned int regression_1095() {
const std::string magic_value = "test_value";
sol::state lua;
lua[magic_value] = magic_value;
if (lua.globals().get<std::string>(magic_value) != magic_value) {
return 1;
}
if (lua.globals().raw_get<std::string>(magic_value) != magic_value) {
return 2;
}
return 0;
}