1 #define SOL_ALL_SAFETIES_ON 1
2 #include <sol/sol.hpp>
3 
4 
main(int,char * [])5 int main(int, char*[]) {
6 
7 	struct protect_me {
8 		int gen(int x) {
9 			return x;
10 		}
11 	};
12 
13 	sol::state lua;
14 	lua.open_libraries(sol::lib::base);
15 	lua.new_usertype<protect_me>("protect_me", "gen", sol::protect(&protect_me::gen));
16 
17 	lua.script(R"__(
18 	pm = protect_me.new()
19 	value = pcall(pm.gen,"wrong argument")
20 	)__");
21 	bool value = lua["value"];
22 	sol_c_assert(!value);
23 
24 	return 0;
25 }
26