😢 Crash mode; need to rearchitecture to fix

This commit is contained in:
ThePhD 2021-05-16 00:00:07 -04:00
parent f5355395b7
commit 430b55a496
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA

View File

@ -9,7 +9,10 @@
#include <sol/sol.hpp>
#include <iostream>
#if THIS_IS_BUSTED
std::string testFunc(std::string str) {
std::cout << "in testFunc" << std::endl;
return std::string("hello ") + str;
}
@ -23,13 +26,17 @@ int main() {
function f ()
-- call a function with wrong arguments
-- to trigger lua_error
print("calling function")
testFunc()
end
)");
std::cout << "bark" << std::endl;
sol::protected_function f(lua["f"]);
std::cout << "baa" << std::endl;
sol::protected_function_result result = f();
std::cout << "meow" << std::endl;
if (result.valid()) {
// Call succeeded
std::cout << "call succeeded" << std::endl;
@ -41,3 +48,9 @@ int main() {
std::cout << "call failed, sol::error::what() is " << what << std::endl;
}
}
#else
int main(int, char*[]) {
return 0;
}
#endif