diff --git a/src/jsapi.c b/src/jsapi.c index 0d57f79..24ab98e 100644 --- a/src/jsapi.c +++ b/src/jsapi.c @@ -561,11 +561,11 @@ static duk_ret_t duk_pmem(duk_context* duk) if(index < TIC_PERSISTENT_SIZE) { - s32 val = memory->persistent.data[index]; + u32 val = memory->persistent.data[index]; if(!duk_is_null_or_undefined(duk, 1)) { - memory->persistent.data[index] = duk_to_int(duk, 1); + memory->persistent.data[index] = duk_to_uint(duk, 1); machine->data->syncPMEM = true; } diff --git a/src/luaapi.c b/src/luaapi.c index 0ccf219..9c35199 100644 --- a/src/luaapi.c +++ b/src/luaapi.c @@ -1064,11 +1064,11 @@ static s32 lua_pmem(lua_State *lua) if(index < TIC_PERSISTENT_SIZE) { - s32 val = memory->persistent.data[index]; + u32 val = memory->persistent.data[index]; if(top >= 2) { - memory->persistent.data[index] = getLuaNumber(lua, 2); + memory->persistent.data[index] = lua_tointeger(lua, 2); machine->data->syncPMEM = true; } diff --git a/src/tic.h b/src/tic.h index ebc7444..bbfa76d 100644 --- a/src/tic.h +++ b/src/tic.h @@ -401,7 +401,7 @@ typedef union typedef struct { - s32 data[TIC_PERSISTENT_SIZE]; + u32 data[TIC_PERSISTENT_SIZE]; } tic_persistent; typedef union diff --git a/src/wrenapi.c b/src/wrenapi.c index 2d7e16e..182e70a 100644 --- a/src/wrenapi.c +++ b/src/wrenapi.c @@ -900,7 +900,7 @@ static void wren_pmem(WrenVM* vm) if(index < TIC_PERSISTENT_SIZE) { - s32 val = memory->persistent.data[index]; + u32 val = memory->persistent.data[index]; if(top > 2) {