From 2bf947018c6c7abb0022b15b2a96a8d3a001abea Mon Sep 17 00:00:00 2001 From: mid <> Date: Sun, 9 Feb 2025 22:23:54 +0200 Subject: [PATCH] game.draw was broken for text --- src/luaapi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/luaapi.c b/src/luaapi.c index 96916f3..fbcb5ab 100644 --- a/src/luaapi.c +++ b/src/luaapi.c @@ -1864,6 +1864,10 @@ static int dagame_draw(lua_State *L) { } else { lua_pop(L, 1); + lua_getfield(L, 1, "font"); + struct k3Font *font = *(void**) lua_touserdata(L, -1); + lua_pop(L, 1); + lua_getfield(L, 1, "align"); lua_getfield(L, 1, "r"); @@ -1878,9 +1882,6 @@ static int dagame_draw(lua_State *L) { lua_getfield(L, 1, "x"); lua_getfield(L, 1, "y"); - lua_getfield(L, 1, "font"); - struct k3Font *font = *(void**) lua_touserdata(L, 1); - struct k3RectF rect; k3FontSz(font, lua_tonumber(L, -4), lua_tostring(L, -3), &rect);