I want to make a plugin that makes gold/iron drop ingots instead of the ore, I adapted the example from the docs but can't seem to get it to work (it crashes cuberite). I'm new to cuberite plugin development (lua in general, actually). I already add the hook HOOK_BLOCK_TO_PICKUPS. Please help

Of course it would help if you showed your code. Do you just have the example from the docs? Do you have a link to the page showing the example?
A plugin shouldn't be able to crash the server. I'd really appreciate if you could post your code so that we can hunt down the bug you've run into.
I've used other ways of trying but this is the one I could seem to replicate. Doesn't work and seems to crash cuberite
function OnBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups)
if (a_Digger ~= nil) then
return false;
end
if (a_BlockType == E_BLOCK_IRON_ORE) then
return true
end
a_Pickups:Clear();
a_Pickups:Add(cItem(E_ITEM_IRON_INGOT));
return true;
end;
Hey,
I checked your code and corrected it.
I think you want to run the code only if it's a player
Also corrected the item that you want to have as a new pickup.
Here you can find a list of all values
http://api-docs.cuberite.org/Globals.html
function OnBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups)
-- Check if digger is null or is not a player
if (a_Digger == nil) or (a_Digger:GetEntityType() ~= cEntity.etPlayer) then
return false
end
-- Check if the block is a iron ore
if (a_BlockType ~= E_BLOCK_IRON_ORE) then
return true
end
-- Clear all defaul pickups
a_Pickups:Clear();
-- Add iron ingot
a_Pickups:Add(cItem(E_ITEM_IRON))
return true
end
If you mean red lines in the terminal, this can be a error inside of cuberite or something gone wrong in a plugin. If the error is from a plugin it's a stack trace, that contains the plugin name and the line of the error.
In this case I think it was the wrong item type, because it was nil and adding a nil value will cause an error.
Omg, thanks. Now I just need to add gold

Problem solved

Epsilith, so was it a crash or just a red error report (and the server continued running)? The red error report is a normal reaction to code errors in plugins.
Oh, I though it actually crashed cuberite... But it might be something else, because it still happens. I can't figure out why it does it, though.