sol2/tests/regression_tests/simple/source/1067.cpp

12 lines
292 B
C++
Raw Normal View History

#include <sol/sol.hpp>
int regression_1067() {
sol::state lua;
lua.open_libraries(sol::lib::base);
lua["fct"] = std::function<int()> { []() { return 42; } };
sol::optional<sol::error> maybe_error = lua.safe_script("print(fct())");
return maybe_error.has_value() ? 1 : 0;
}