623 - I don't know if the law in Scotland is different from England but it is definitely NOT true that taking something that is not yours on public ground is not stealing. Firstly, a warehouse where people are employed is NOT public. Secondly, if you lost your wallet and it was found laying on the ground in the street, anyone who takes it and uses the contents IS STEALING.
An open lorry full of sweets waiting to be delivered is SOMES PROPERTY and if people help themselves from the lorry they are STEALING.
Bounty - there is no grey area - you were naughty but most people in your position would have done the same. However, most people would draw the line at robbing the back of a truckload of sweets.