test some stuff
Some checks failed
Build Dusk / run-tests (push) Failing after 2m48s
Build Dusk / build-linux (push) Failing after 2m21s
Build Dusk / build-psp (push) Failing after 1m46s
Build Dusk / build-dolphin (push) Failing after 1m57s

This commit is contained in:
2026-02-09 10:39:46 -06:00
parent 2f5dccc3ef
commit bd54469891
7 changed files with 115 additions and 22 deletions

View File

@@ -27,9 +27,8 @@ void moduleColor(scriptcontext_t *context) {
lua_pushstring(context->luaState, "__tostring");
lua_pushcfunction(context->luaState, moduleColorToString);
lua_settable(context->luaState, -3);
lua_pop(context->luaState, 1);
}
lua_pop(context->luaState, 1);
lua_register(context->luaState, "color", moduleColorFuncColor);
lua_register(context->luaState, "colorRainbow", moduleColorRainbow);

View File

@@ -46,6 +46,21 @@ int moduleTilesetIndex(lua_State *l) {
} else if(stringCompare(key, "texture") == 0) {
lua_pushstring(l, ts->image);
return 1;
} else if(stringCompare(key, "tileWidth") == 0) {
lua_pushnumber(l, ts->tileWidth);
return 1;
} else if(stringCompare(key, "tileHeight") == 0) {
lua_pushnumber(l, ts->tileHeight);
return 1;
} else if(stringCompare(key, "tileCount") == 0) {
lua_pushnumber(l, ts->tileCount);
return 1;
} else if(stringCompare(key, "columns") == 0) {
lua_pushnumber(l, ts->columns);
return 1;
} else if(stringCompare(key, "rows") == 0) {
lua_pushnumber(l, ts->rows);
return 1;
}
lua_pushnil(l);

View File

@@ -13,21 +13,20 @@ void moduleTime(scriptcontext_t *ctx) {
// Script structure
if(luaL_newmetatable(ctx->luaState, "time_mt")) {
// Metatable is new, set __index
lua_pushstring(ctx->luaState, "__index");
lua_pushcfunction(ctx->luaState, moduleTimeIndex);
lua_settable(ctx->luaState, -3);
lua_setfield(ctx->luaState, -2, "__index");
}
lua_pop(ctx->luaState, 1);
// Global time struct
lua_pushlightuserdata(ctx->luaState, &TIME);
dusktime_t **ud = (dusktime_t**)lua_newuserdatauv(
ctx->luaState, sizeof(dusktime_t*), 0
);
*ud = &TIME;
luaL_setmetatable(ctx->luaState, "time_mt");
lua_setglobal(ctx->luaState, "TIME");
}
int moduleTimeIndex(lua_State *L) {
assertNotNull(L, "Lua state cannot be NULL.");
const char_t *key = lua_tostring(L, 2);
assertStrLenMin(key, 1, "Key cannot be empty.");