VERSIÓ 1.4.7

- [NEW] map.cell() per a establir o llegir el tamany dels tiles del mapa
This commit is contained in:
2026-03-19 11:29:08 +01:00
parent 779ef7acb6
commit 4a3450e116
5 changed files with 51 additions and 15 deletions

17
lua.cpp
View File

@@ -217,7 +217,21 @@ extern "C" {
return 0;
}
}
static int cpp_map_cell(lua_State *L) {
if (lua_gettop(L)==2) {
int celx = luaL_checknumber(L, 1);
int cely = luaL_checknumber(L, 2);
settilesize(celx, cely);
lua_pushinteger(L, mget(celx, cely));
return 0;
} else {
lua_pushinteger(L, gettilew());
lua_pushinteger(L, gettileh());
return 2;
}
}
// palette
// ===============================================
@@ -1120,6 +1134,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_map_surf); lua_setfield(L, -2, "surf");
lua_pushcfunction(L,cpp_map_draw); lua_setfield(L, -2, "draw");
lua_pushcfunction(L,cpp_map_tile); lua_setfield(L, -2, "tile");
lua_pushcfunction(L,cpp_map_cell); lua_setfield(L, -2, "cell");
lua_setglobal(L, "map");
lua_newtable(L);