From 91ddf5696a5e58137a3e34cbd7a894c93314558e Mon Sep 17 00:00:00 2001 From: meehl <12648828+meehl@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:54:28 +0100 Subject: [PATCH] Make alignment argument in `draw_string` API function optional --- src/pob/api/text.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pob/api/text.rs b/src/pob/api/text.rs index 066ca5c..7dabf91 100644 --- a/src/pob/api/text.rs +++ b/src/pob/api/text.rs @@ -50,7 +50,11 @@ pub unsafe extern "C-unwind" fn draw_string(state: *mut ffi::lua_State) -> c_int let x = f32_from_stack!(state, -nargs); let y = f32_from_stack!(state, -nargs + 1); - let alignment = str_from_stack!(state, -nargs + 2); + let alignment = if unsafe { ffi::lua_isnil(state, -nargs + 2) } != 0 { + "LEFT" + } else { + str_from_stack!(state, -nargs + 2) + }; let line_height = i32_from_stack!(state, -nargs + 3); let font_type = str_from_stack!(state, -nargs + 4); let text = str_from_stack!(state, -nargs + 5);