| 228 | } |
| 229 | |
| 230 | static int Vector_newindex(lua_State *L) |
| 231 | { |
| 232 | FloatVector* v = *(FloatVector**)lua_touserdata(L, 1); |
| 233 | |
| 234 | int key = luaL_checkinteger(L, 2); |
| 235 | if (key > 0 && key <= v->size) |
| 236 | { |
| 237 | v->values[key-1] = (float)luaL_checknumber(L, 3); |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | if (v->size > 0) |
| 242 | { |
| 243 | return luaL_error(L, "%s.%s only has valid indices between 1 and %d.", SCRIPT_LIB_NAME, SCRIPT_TYPE_NAME_VECTOR, v->size); |
| 244 | } |
| 245 | |
| 246 | return luaL_error(L, "%s.%s has no addressable indices, size is 0.", SCRIPT_LIB_NAME, SCRIPT_TYPE_NAME_VECTOR); |
| 247 | } |
| 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | static int Vector_tostring(lua_State *L) |
| 252 | { |
nothing calls this directly
no test coverage detected