Items created by lua will behave very strangely when picked up
While testing one of my mods, I created a new record and object to replace an existing object seamlessly. I would have issues where the object I created would not appear when I dropped it after saving and reloading.
After a good amount of digging, I found that the issue had nothing to do with new records. It seems to have to do with teleporting an object in the same frame as it is created.
To reproduce: (I recommend the cell "Dagon Fel, Heifer: Trader")
Enter any cell. Select an item with the console open, and enter lua global mode with luag
Type the following command, and hit enter.
newobj = world.createObject(selected.recordId):teleport(selected.cell,selected.position,selected.rotation);selected:remove()
Pick up the object, and save your game. Load your game you just created. At 0,0,0 in your current cell, you will find the item you picked up. It will also be in your inventory.
If you drop the item, it will vanish from its current location, but will not appear where you drop it.
If you take the item out of the cell, it appears to work as expected.
In this screenshot, you can see the candle in both my inventory and in the world. I printed the ID of each to confirm it is the same thing.
After I tried to drop the candle in my inventory, it appeared here, with the count of 0.