| 338 | } |
| 339 | |
| 340 | bool container_identity::lua_insert2(lua_State *state, int fname_idx, void *ptr, int idx, int val_index) const |
| 341 | { |
| 342 | auto id = (type_identity*)lua_touserdata(state, UPVAL_ITEM_ID); |
| 343 | |
| 344 | char tmp[32]; |
| 345 | void *pitem = &tmp; |
| 346 | |
| 347 | if (id->isPrimitive()) |
| 348 | { |
| 349 | if (id->isConstructed()) |
| 350 | luaL_error(state, "Temporaries of type %s not supported", id->getFullName().c_str()); |
| 351 | |
| 352 | assert(id->byte_size() <= sizeof(tmp)); |
| 353 | id->lua_write(state, fname_idx, pitem, val_index); |
| 354 | } |
| 355 | else |
| 356 | { |
| 357 | pitem = get_object_internal(state, id, val_index, false); |
| 358 | if (!pitem) |
| 359 | field_error(state, fname_idx, "incompatible object type", "insert"); |
| 360 | } |
| 361 | |
| 362 | return insert(ptr, idx, pitem); |
| 363 | } |
| 364 | |
| 365 | void ptr_container_identity::lua_item_reference(lua_State *state, int fname_idx, void *ptr, int idx) const |
| 366 | { |
no test coverage detected