diff --git a/main.c b/main.c index f05a3854532b65141ecd78c0f35767f08ef5d963..7c05a6afa8374b97a5d20a5393dfde4719700b71 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 @@ // Loading embeded modules into Lua state. 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 0000000000000000000000000000000000000000..bcf1418ede2f5d4f7bb37e025f8a5c812aa42100 --- /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