VERSIÓ 1.3.13

- [NEW]  Executant la versió de debug amb el paràmeter "--new" crea un projecte nou en eixe directori.
- [NEW] Nou sistema de log
- [FIX] Amb el tema de usar std::vector no s'estava inicialitzant la surface de pantalla correctament.
- [FIX] Proteccions per a que no pete quan s'intenta usar funcions que els fa falta una surface de oritge, pero no hi ha ninguna seleccionada.
- [NEW] file_createFolder() (ATENCIÓ: No funcionarà en Windows encara)
This commit is contained in:
2025-12-03 14:05:52 +01:00
parent ace4a0f9f0
commit 3e524fd32d
9 changed files with 133 additions and 69 deletions

28
lua.cpp
View File

@@ -2,7 +2,7 @@
#include "lua/lua.hpp"
#include "mini.h"
#include "jfile.h"
#include "log.h"
#include <filesystem>
namespace fs = std::filesystem;
@@ -1181,8 +1181,7 @@ int MiniLoader(lua_State *L) {
int size;
char* buffer = file_getfilebuffer(filename, size);
if (luaL_loadbuffer(L, buffer, size, filename)) {
debug("REQUIRE LOADING ERROR: ");
debug("%s\n",lua_tostring(L, -1));
log_msg(LOG_LUALD, "%s\n",lua_tostring(L, -1));
lua_pop(L,1);
//return ;
}
@@ -1200,19 +1199,14 @@ void lua_init(const char *main_lua_file) {
int size;
char* buffer = file_getfilebuffer(main_lua_file, size);
if (luaL_loadbuffer(L, buffer, size, "main")) {
debug("LOADING ERROR: ");
debug("%s\n",lua_tostring(L, -1));
log_msg(LOG_LUALD, "%s\n", lua_tostring(L, -1));
lua_pop(L,1);
return;
}
free(buffer);
if (lua_pcall(L,0, LUA_MULTRET, 0)) {
debug("RUNTIME ERROR [BOOT]: ");
//debug("%s\n",lua_tostring(L, -1));
//lua_pop(L,1);
luaL_traceback(L, L, NULL, 1);
debug("%s\n", lua_tostring(L, -1));
//luaL_traceback(L, L, NULL, 1);
log_msg(LOG_LUART, "%s\n", lua_tostring(L, -1));
lua_pop(L,1);
return;
}
@@ -1238,11 +1232,7 @@ void lua_call_init() {
lua_getglobal(L, "mini");
lua_getfield(L, -1, "init");
if (lua_pcall(L, 0, 0, 0)) {
debug("RUNTIME ERROR [INIT]: ");
debug("%s\n",lua_tostring(L, -1));
lua_pop(L,1);
luaL_traceback(L, L, NULL, 1);
debug("%s\n", lua_tostring(L, -1));
log_msg(LOG_LUART, "%s\n", lua_tostring(L, -1));
lua_pop(L,1);
is_playing = false;
}
@@ -1255,11 +1245,7 @@ void lua_call_update() {
lua_getglobal(L, "mini");
lua_getfield(L, -1, "update");
if (lua_pcall(L, 0, 0, 0)) {
debug("RUNTIME ERROR [UPDATE]: ");
debug("%s\n",lua_tostring(L, -1));
lua_pop(L,1);
luaL_traceback(L, L, NULL, 1);
debug("%s\n", lua_tostring(L, -1));
log_msg(LOG_LUART, "%s\n", lua_tostring(L, -1));
lua_pop(L,1);
is_playing = false;
}