file.write_bytes fix

This commit is contained in:
Onran 2024-02-27 03:54:04 +09:00 committed by GitHub
parent 9ada76c731
commit ede5aeb9b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,6 +140,10 @@ int l_file_write_bytes(lua_State* L) {
int i = 1;
while(lua_next(L, bytesIndex) != 0) {
if(i == len) {
break;
}
if(lua_isnumber(L, -1)) {
const int byte = lua_tointeger(L, -1);
@ -153,7 +157,7 @@ int l_file_write_bytes(lua_State* L) {
i++;
} else {
return luaL_error(L, "number expected at index '%i'", i);
return luaL_error(L, "number expected at index '%i' (got %s)", i, lua_typename(L, lua_type(L, -1)));
}
}