And... What the hell, here is the code.
Del() //Now for the boxes deletion
if(C)
for(var/O in Images) //clean up all the images
del(O)
M.box -= src //The player will no longer have that box -- LINE THE ERROR IS ON
if(!M.box) M.box = null //If that was the last one, we need to get rid of the list for memory's sake
..() //Delete that box
The library works normally, but not when incorporated into another program.
Resonating Light
Also, your if(!M.box) check is kind of useless; if that if() is true it's because M.box is already null. An empty list is still a true value, so if(!M.box.len) is what you'd really need.
Lummox JR