diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2025-08-06 11:53:25 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2025-08-06 11:53:25 +0200 |
| commit | 65493b814a59212122e50216ed458c5c87289cc7 (patch) | |
| tree | 95bc13975ed84617c74b3861e9e0298d5c176f21 /main.c | |
| parent | a007b4dd156ae1eae302cd43e22186caf854069b (diff) | |
| download | bidi-65493b814a59212122e50216ed458c5c87289cc7.tar.gz | |
Added skeleton tilemap module to stdlib
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -5,8 +5,9 @@ #include "lualib.h" #include "lauxlib.h" -#include "stdlib/color.h" #include "stdlib/json.h" +#include "stdlib/color.h" +#include "stdlib/tilemap.h" #define IN_FILE "test/main.lua" #define DEBUG_LEVEL LOG_DEBUG @@ -97,6 +98,14 @@ int main(void) { lua_register(L, "draw_fps", l_draw_fps); lua_register(L, "clear_window", l_clear_window); + // Embedding JSON module. + if (luaL_loadbuffer(L, json, json_len, "json") || lua_pcall(L, 0, 1, 0)) { + fprintf(stderr, "Error loading json.lua: %s\n", lua_tostring(L, -1)); + lua_close(L); + return 1; + } + lua_setglobal(L, "json"); + // Embedding color module. if (luaL_loadbuffer(L, color, color_len, "color") || lua_pcall(L, 0, 1, 0)) { fprintf(stderr, "Error loading color.lua: %s\n", lua_tostring(L, -1)); @@ -105,13 +114,13 @@ int main(void) { } lua_setglobal(L, "color"); - // Embedding JSON module. - if (luaL_loadbuffer(L, json, json_len, "json") || lua_pcall(L, 0, 1, 0)) { - fprintf(stderr, "Error loading json.lua: %s\n", lua_tostring(L, -1)); + // Embedding tilemap module. + if (luaL_loadbuffer(L, tilemap, tilemap_len, "tilemap") || lua_pcall(L, 0, 1, 0)) { + fprintf(stderr, "Error loading tilemap.lua: %s\n", lua_tostring(L, -1)); lua_close(L); return 1; } - lua_setglobal(L, "json"); + lua_setglobal(L, "tilemap"); // Interpreting and running input file Lua script. if (luaL_loadfile(L, IN_FILE) || lua_pcall(L, 0, 0, 0)) { |
