| 344 | // *********************************************************************** |
| 345 | |
| 346 | i32 Get(lua_State* L) { |
| 347 | UserData* pUserData = (UserData*)luaL_checkudata(L, 1, "UserData"); |
| 348 | i32 index = (i32)luaL_checkinteger(L, 2); |
| 349 | i32 count = (i32)luaL_checkinteger(L, 3); |
| 350 | if (index + count > pUserData->width * pUserData->height) { |
| 351 | luaL_error(L, "Out of bounds read on userdata with size (%d,%d) at index %d", pUserData->width, pUserData->height, index); |
| 352 | return 0; |
| 353 | } |
| 354 | return GetImpl(L, pUserData, index, count); |
| 355 | } |
| 356 | |
| 357 | // *********************************************************************** |
| 358 | |