From eb5dee514ba02f866d1eb3378df9ccc5830e7747 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Mon, 11 Aug 2025 19:35:30 +0200 Subject: Added helpers to stdlib --- main.c | 2 ++ stdlib/helpers.lua | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 stdlib/helpers.lua diff --git a/main.c b/main.c index f05a385..7c05a6a 100644 --- a/main.c +++ b/main.c @@ -13,6 +13,7 @@ #include "stdlib/json.h" #include "stdlib/color.h" #include "stdlib/button.h" +#include "stdlib/helpers.h" #include "fonts/dejavusans_mono_bold.h" @@ -593,6 +594,7 @@ int main(int argc, char *argv[]) { if (!load_embedded_module(L, json, json_len, "json")) return 1; if (!load_embedded_module(L, color, color_len, "color")) return 1; if (!load_embedded_module(L, button, button_len, "button")) return 1; + if (!load_embedded_module(L, helpers, helpers_len, "helpers")) return 1; // Registring Raylib mappings. lua_register(L, "open_window", l_open_window); diff --git a/stdlib/helpers.lua b/stdlib/helpers.lua new file mode 100644 index 0000000..bcf1418 --- /dev/null +++ b/stdlib/helpers.lua @@ -0,0 +1,11 @@ +function print_table(t, indent) + indent = indent or "" + for key, value in pairs(t) do + if type(value) == "table" then + print(indent .. key .. ":") + print_table(value, indent .. " ") + else + print(indent .. key .. ": " .. tostring(value)) + end + end +end -- cgit v1.2.3