How do I place a block with lua

Posted:
Thu Nov 22, 2012 12:19
by OmniStudent
I need a simple lua script that places a block of a certain type in a certain position.
Could anyone tell me how to do this please?

Posted:
Thu Nov 22, 2012 13:28
by VanessaE
To be specific, you want the add_node() function.
Unless you're replacing a specific material, always check for the presence of air in the location where your new node is being placed (to avoid "content ignore" warnings and wasted materials).
Also, if you're adding a node in response to a player action (as opposed to just spawning randomly inside an ABM or map generator hook), be sure to check for the presence of node_ownership and glomie's protection mod, and heed any warnings those give. This prevents others using your mod to grief a server that runs your mod and those.