file.write_bytes fix
This commit is contained in:
parent
9ada76c731
commit
ede5aeb9b7
@ -140,6 +140,10 @@ int l_file_write_bytes(lua_State* L) {
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
while(lua_next(L, bytesIndex) != 0) {
|
while(lua_next(L, bytesIndex) != 0) {
|
||||||
|
if(i == len) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(lua_isnumber(L, -1)) {
|
if(lua_isnumber(L, -1)) {
|
||||||
const int byte = lua_tointeger(L, -1);
|
const int byte = lua_tointeger(L, -1);
|
||||||
|
|
||||||
@ -153,7 +157,7 @@ int l_file_write_bytes(lua_State* L) {
|
|||||||
|
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} 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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user