summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2025-08-11 19:35:30 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2025-08-11 19:35:30 +0200
commiteb5dee514ba02f866d1eb3378df9ccc5830e7747 (patch)
tree6214c74e00d221dc758f2764dfdcd5b2ac8b590b
parent74e8b2f3b70545a0afd81be6bd4a391dbf5529ae (diff)
downloadbidi-eb5dee514ba02f866d1eb3378df9ccc5830e7747.tar.gz
Added helpers to stdlib
-rw-r--r--main.c2
-rw-r--r--stdlib/helpers.lua11
2 files changed, 13 insertions, 0 deletions
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