Code: Select all
for name,count in pairs(fakePlayer.get_inventory(invMain).get_contents()) do
fakePlayer.remove_item({name=name, count=car.insert({name=name, count=count})})
end
wasted memory and wasted lua CPU cycles when the method could just return if 0, and throw the error if < 0.
All that would really be needed is at the beginning of the method, add in the equivilant of:
Code: Select all
if(count == 0){return;}
I'll be posting a feature request later on for a method in inventory to do this logic to make things easier for mods, here is my thought of the method call:
Code: Select all
fakePlayer.get_inventory(invMain).move_to(car or car.get_inventory)
Code: Select all
fakePlayer.move_inventory_to(car)