| 3 | |
| 4 | |
| 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>( |
| 16 | "protect_me", "gen", sol::protect(&protect_me::gen)); |
| 17 | |
| 18 | lua.script(R"__( |
| 19 | pm = protect_me.new() |
| 20 | value = pcall(pm.gen,"wrong argument") |
| 21 | )__"); |
| 22 | bool value = lua["value"]; |
| 23 | SOL_ASSERT(!value); |
| 24 | |
| 25 | return 0; |
| 26 | } |
nothing calls this directly
no test coverage detected