diff options
author | 2020-11-15 03:53:47 +1100 | |
---|---|---|
committer | 2020-11-15 03:53:47 +1100 | |
commit | 55b8ca317ab1f77850f498c1523355e1f5dd8d03 (patch) | |
tree | bada7948236b18684609f47024cc9ca227a5ef89 /3rdparty/sol2/examples/protected_functions.cpp | |
parent | 4db7f0439c3b841eb07d2320e39be38269e6cd56 (diff) |
-Switch to building MAME as C++17.
* Updated sol2 to 3.2.2
* Updated pugixml to 1.10
* Increased minimum clang version to 6
* Cleaned up some stuff that can use new features
Diffstat (limited to '3rdparty/sol2/examples/protected_functions.cpp')
-rw-r--r-- | 3rdparty/sol2/examples/protected_functions.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/3rdparty/sol2/examples/protected_functions.cpp b/3rdparty/sol2/examples/protected_functions.cpp deleted file mode 100644 index 340f0134d63..00000000000 --- a/3rdparty/sol2/examples/protected_functions.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include <sol.hpp> - -#include <iostream> - -int main() { - std::cout << "=== protected_functions example ===" << std::endl; - - sol::state lua; - - // A complicated function which can error out - // We define both in terms of Lua code - - lua.script(R"( - function handler (message) - return "Handled this message: " .. message - end - - function f (a) - if a < 0 then - error("negative number detected") - end - return a + 5 - end - )"); - - // Get a protected function out of Lua - sol::protected_function f = lua["f"]; - // Set a non-default error handler - f.error_handler = lua["handler"]; - - sol::protected_function_result result = f(-500); - if (result.valid()) { - // Call succeeded - int x = result; - std::cout << "call succeeded, result is " << x << std::endl; - } - else { - // Call failed - sol::error err = result; - std::string what = err.what(); - std::cout << "call failed, sol::error::what() is " << what << std::endl; - // 'what' Should read - // "Handled this message: negative number detected" - } - - std::cout << std::endl; -} |