return map coords as a coord, not x, y, z

develop
Myk Taylor 2022-09-18 13:27:33 -07:00
parent dbc5001bd8
commit 28b70eaee9
No known key found for this signature in database
1 changed files with 8 additions and 8 deletions

@ -1525,8 +1525,12 @@ static int gui_getDwarfmodeViewDims(lua_State *state)
static int gui_getMousePos(lua_State *L) static int gui_getMousePos(lua_State *L)
{ {
Lua::PushPosXYZ(L, Gui::getMousePos()); auto pos = Gui::getMousePos();
return 3; if (pos.isValid())
Lua::Push(L, pos);
else
lua_pushnil(L);
return 1;
} }
static const LuaWrapper::FunctionReg dfhack_gui_module[] = { static const LuaWrapper::FunctionReg dfhack_gui_module[] = {
@ -2289,16 +2293,12 @@ static const LuaWrapper::FunctionReg dfhack_screen_module[] = {
static int screen_getMousePos(lua_State *L) static int screen_getMousePos(lua_State *L)
{ {
Lua::PushPosXY(L, Screen::getMousePos()); return Lua::PushPosXY(L, Screen::getMousePos());
return 2;
} }
static int screen_getWindowSize(lua_State *L) static int screen_getWindowSize(lua_State *L)
{ {
auto pos = Screen::getWindowSize(); return Lua::PushPosXY(L, Screen::getWindowSize());
lua_pushinteger(L, pos.x);
lua_pushinteger(L, pos.y);
return 2;
} }
static int screen_paintTile(lua_State *L) static int screen_paintTile(lua_State *L)