diff options
| author | Alexander Gavrilov | 2012-09-18 20:45:59 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-18 20:45:59 +0400 |
| commit | a4799a384b2f33be5b3fcf43b462175de6ce7f65 (patch) | |
| tree | 638110fb9f3d1c951cf03ceee0aaa3577cc14715 | |
| parent | 57b72831ca700ab556566a85f2245e014ca96c30 (diff) | |
| download | dfhack-a4799a384b2f33be5b3fcf43b462175de6ce7f65.tar.gz dfhack-a4799a384b2f33be5b3fcf43b462175de6ce7f65.tar.bz2 dfhack-a4799a384b2f33be5b3fcf43b462175de6ce7f65.tar.xz | |
Catch C++ exceptions in dfhack.buildings.setSize
| -rw-r--r-- | library/LuaApi.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index f8497569..d73d14cf 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1084,7 +1084,9 @@ static int buildings_getCorrectSize(lua_State *state) return 5; } -static int buildings_setSize(lua_State *state) +namespace { + +int buildings_setSize(lua_State *state) { auto bld = Lua::CheckDFObject<df::building>(state, 1); df::coord2d size(luaL_optint(state, 2, 1), luaL_optint(state, 3, 1)); @@ -1105,11 +1107,13 @@ static int buildings_setSize(lua_State *state) return 1; } +} + static const luaL_Reg dfhack_buildings_funcs[] = { { "findAtTile", buildings_findAtTile }, { "findCivzonesAt", buildings_findCivzonesAt }, { "getCorrectSize", buildings_getCorrectSize }, - { "setSize", buildings_setSize }, + { "setSize", &Lua::CallWithCatchWrapper<buildings_setSize> }, { NULL, NULL } }; |
