| 316 | } |
| 317 | |
| 318 | static int Vector3_newindex(lua_State *L) |
| 319 | { |
| 320 | Vector3* v = (Vector3*)lua_touserdata(L, 1); |
| 321 | |
| 322 | const char* key = luaL_checkstring(L, 2); |
| 323 | if (key[0] == 'x') |
| 324 | { |
| 325 | v->setX((float) luaL_checknumber(L, 3)); |
| 326 | } |
| 327 | else if (key[0] == 'y') |
| 328 | { |
| 329 | v->setY((float) luaL_checknumber(L, 3)); |
| 330 | } |
| 331 | else if (key[0] == 'z') |
| 332 | { |
| 333 | v->setZ((float) luaL_checknumber(L, 3)); |
| 334 | } |
| 335 | else |
| 336 | { |
| 337 | return luaL_error(L, "%s.%s only has fields x, y, z.", SCRIPT_LIB_NAME, SCRIPT_TYPE_NAME_VECTOR3); |
| 338 | } |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | static int Vector3_add(lua_State *L) |
| 343 | { |
nothing calls this directly
no test coverage detected