Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robust Lua error handling and quarantining #33

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified FlyWithLua/64/win.xpl
Binary file not shown.
28 changes: 28 additions & 0 deletions FlyWithLua/Scripts/errors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
failure_mode = 8

if failure_mode == 1 then
local fail
fail()
elseif failure_mode == 2 then
error("manually triggered error")
elseif failure_mode == 3 then
crash_lua_legacy()
elseif failure_mode == 4 then
crash_lua_legacy_exception()
elseif failure_mode == 5 then
crash_lua_exception()
elseif failure_mode == 6 then
local function f(arg)
f(arg)
end
f("Crash and burn!")
elseif failure_mode == 7 then
do_often("print('Will error now!')")
do_often("error('manually triggered error')")
elseif failure_mode == 8 then
function crash_and_burn()
print('Will error now!')
error('manually triggered error')
end
do_often("crash_and_burn()")
end
12 changes: 9 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ add_compile_options(-fvisibility=hidden)
add_compile_options(-Wall -Wpedantic -Wshadow -Wfloat-equal -Wextra)
add_compile_options(-Wno-unused)

# Always use position-independent code and highest optimization level (FPS!).
add_compile_options(-O3 -fPIC)
# Always use position-independent code.
add_compile_options(-fPIC)
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
# Use and highest optimization level in release builds (FPS!)
add_compile_options(-O3)
else()
add_compile_options(-O0)
endif()

# X-Plane plugin
# FIXME: Split this into individual targets.
list(APPEND FLYWITHLUA_SRCS FlyWithLua.cpp)
list(APPEND FLYWITHLUA_SRCS FlyWithLua.cpp runtime.cpp runtime.h)
list(APPEND FLYWITHLUA_SRCS FloatingWindows/FLWIntegration.cpp FloatingWindows/ImGUIIntegration.cpp FloatingWindows/FloatingWindow.cpp)
list(APPEND FLYWITHLUA_SRCS imgui/imgui.cpp imgui/imgui_demo.cpp imgui/imgui_draw.cpp imgui/imgui_lua_bindings.cpp)
if (WIN32)
Expand Down
Loading