allow lua to access array at an offset

This commit is contained in:
Robin Gareus 2016-05-21 15:43:19 +02:00
parent 53c188beb3
commit 50d6f146f4
2 changed files with 14 additions and 1 deletions

View file

@ -969,6 +969,14 @@ struct CFunc
return 0;
}
// return same array at an offset
template <typename T>
static int offsetArray (lua_State* L) {
T *v = luabridge::Stack<T*>::get (L, 1);
const unsigned int i = luabridge::Stack<unsigned int>::get (L, 2);
Stack <T*>::push (L, &v[i]);
return 1;
}
//--------------------------------------------------------------------------
/**