mirror of https://github.com/bjornbytes/lovr.git
Fix negative index for luax_readobjarr
This commit is contained in:
parent
9e3336ad60
commit
1a321d004b
|
@ -579,7 +579,8 @@ int luax_readmesh(lua_State* L, int index, float** vertices, uint32_t* vertexCou
|
|||
}
|
||||
|
||||
void luax_readobjarr(lua_State* L, int index, int n, float* out, const char* name) {
|
||||
lovrCheck(lua_objlen(L, index) >= n, "length of %s table must >= %i", name, n);
|
||||
lovrCheck(luax_len(L, index) >= n, "length of %s table must >= %i", name, n);
|
||||
if (index < 0) index = lua_gettop(L) + index + 1;
|
||||
for (int i = 0; i < n; i++) {
|
||||
lua_rawgeti(L, index, i + 1);
|
||||
out[i] = lua_tonumber(L, -1);
|
||||
|
|
Loading…
Reference in New Issue