mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Lua Array, assert indices > 0
This commit is contained in:
parent
fbacb13d2d
commit
34c4602e61
1 changed files with 2 additions and 0 deletions
|
|
@ -1050,6 +1050,7 @@ struct CFunc
|
||||||
static int array_index (lua_State* L) {
|
static int array_index (lua_State* L) {
|
||||||
T** parray = (T**) luaL_checkudata (L, 1, typeid(T).name());
|
T** parray = (T**) luaL_checkudata (L, 1, typeid(T).name());
|
||||||
int const index = luabridge::Stack<int>::get (L, 2);
|
int const index = luabridge::Stack<int>::get (L, 2);
|
||||||
|
assert (index > 0);
|
||||||
luabridge::Stack<T>::push (L, (*parray)[index-1]);
|
luabridge::Stack<T>::push (L, (*parray)[index-1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1060,6 +1061,7 @@ struct CFunc
|
||||||
T** parray = (T**) luaL_checkudata (L, 1, typeid(T).name());
|
T** parray = (T**) luaL_checkudata (L, 1, typeid(T).name());
|
||||||
int const index = luabridge::Stack<int>::get (L, 2);
|
int const index = luabridge::Stack<int>::get (L, 2);
|
||||||
T const value = luabridge::Stack<T>::get (L, 3);
|
T const value = luabridge::Stack<T>::get (L, 3);
|
||||||
|
assert (index > 0);
|
||||||
(*parray)[index-1] = value;
|
(*parray)[index-1] = value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue