11-- Empty a bin onto the floor
2- -- Based on " emptybin" by StoneToad
2+ -- Based on ' emptybin' by StoneToad
33-- https://gist.github.com/stonetoad/11129025
44-- http://dwarffortresswiki.org/index.php/DF2014_Talk:Bin
55
6- local argparse = require (" argparse" )
6+ local argparse = require (' argparse' )
77
88local options , args = {
99 help = false ,
@@ -15,20 +15,20 @@ local options, args = {
1515local function emptyContainer (container )
1616 local items = dfhack .items .getContainedItems (container )
1717 if # items > 0 then
18- print (" Emptying " .. dfhack .items .getReadableDescription (container ))
18+ print (' Emptying ' .. dfhack .items .getReadableDescription (container ))
1919 local pos = xyz2pos (dfhack .items .getPosition (container ))
2020 for _ , item in ipairs (items ) do
2121 local skip_liquid =
2222 item :getType () == df .item_type .LIQUID_MISC or
2323 item :getType () == df .item_type .DRINK and not options .liquids
2424 if skip_liquid then
2525 print (
26- " " ..
26+ ' ' ..
2727 dfhack .items .getReadableDescription (item ) ..
28- " was skipped because the liquid flag was not provided"
28+ ' was skipped because the liquid flag was not provided'
2929 )
3030 else
31- print (" " .. dfhack .items .getReadableDescription (item ))
31+ print (' ' .. dfhack .items .getReadableDescription (item ))
3232 dfhack .items .moveToGround (item , pos )
3333 if options .recursive then
3434 emptyContainer (item )
@@ -42,22 +42,22 @@ argparse.processArgsGetopt(
4242 args ,
4343 {
4444 {
45- " h " ,
46- " help" ,
45+ ' h ' ,
46+ ' help' ,
4747 handler = function ()
4848 options .help = true
4949 end
5050 },
5151 {
52- " r " ,
53- " recursive" ,
52+ ' r ' ,
53+ ' recursive' ,
5454 handler = function ()
5555 options .recursive = true
5656 end
5757 },
5858 {
59- " l " ,
60- " liquids" ,
59+ ' l ' ,
60+ ' liquids' ,
6161 handler = function ()
6262 options .liquids = true
6363 end
@@ -97,5 +97,5 @@ elseif viewsheets.open then
9797 emptyContainer (item )
9898 end
9999else
100- qerror (" Please select a container, building, stockpile, or tile with a list of items." )
100+ qerror (' Please select a container, building, stockpile, or tile with a list of items.' )
101101end
0 commit comments