diff --git a/src/common/Variant.cpp b/src/common/Variant.cpp index 24305d2ac..69d49ae7a 100644 --- a/src/common/Variant.cpp +++ b/src/common/Variant.cpp @@ -134,7 +134,7 @@ Variant::~Variant() Variant *Variant::fromLua(lua_State *L, int n, bool allowTables) { - Variant *v = NULL; + Variant *v = nullptr; size_t len; const char *str; if (n < 0) // Fix the stack position, we might modify it later diff --git a/src/modules/event/wrap_Event.cpp b/src/modules/event/wrap_Event.cpp index 718ea5dc7..747417073 100644 --- a/src/modules/event/wrap_Event.cpp +++ b/src/modules/event/wrap_Event.cpp @@ -97,9 +97,19 @@ int w_clear(lua_State *) int w_quit(lua_State *L) { - Message *m = new Message("quit"); + std::vector> args; + + Variant *v = Variant::fromLua(L, 1); + if (v) + { + args.push_back(v); + v->release(); + } + + Message *m = new Message("quit", args); instance()->push(m); m->release(); + luax_pushboolean(L, true); return 1; } diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index dbc9b1984..e303036c6 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -651,13 +651,12 @@ int Font::getWidth(const std::string &str) prevglyph = c; } } - catch(utf8::exception &e) + catch (utf8::exception &e) { throw love::Exception("UTF-8 decoding error: %s", e.what()); } - if (width > max_width) - max_width = width; + max_width = std::max(max_width, width); } return max_width; diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index a52fc5e94..71ff64756 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -523,7 +523,7 @@ function love.run() for name, a,b,c,d,e,f in love.event.poll() do if name == "quit" then if not love.quit or not love.quit() then - return + return a end end love.handlers[name](a,b,c,d,e,f) diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 62d56c763..4c5169357 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -962,7 +962,7 @@ const unsigned char boot_lua[] = 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x74, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x74, 0x28, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x0a, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x5b,