dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Add "count" parameter to Items::createItem

Open quietust opened this issue 6 months ago • 2 comments

and update the "createitem" plugin to specify it instead of creating a bunch of individual items in a loop.

Fixes #5481.

quietust avatar Jun 21 '25 16:06 quietust

I did not modify modtools/create-item, since it already has its own workaround code for handling item stacks (and it should continue to work as-is).

quietust avatar Jun 21 '25 16:06 quietust

This appears to have broken modtools/create-item, despite my efforts to maintain compatibility: apparently, luaL_optint(state, 7, 1) returns zero when the parameter is absent, rather than returning 1 like I was expecting.

Numerous other functions are also using luaL_optint and are presumably expecting similar behavior, so we might need to review this in general, but for now I've pushed a workaround which appears to work correctly.

quietust avatar Jun 25 '25 16:06 quietust