So I'm working on a australia mod (aussie) and I'm trying to make a brebong (cassowary plum) tree for taming cassowarys. i based it off of the default tree api and at this string of code
minetest.register_abm({
nodenames = {"aussie:brebongsapling"},
interval = 10,
chance = 50,
action = function(pos, node)
if not default.can_grow(pos) then
return
end
local mapgen = minetest.get_mapgen_params().mgname
if node.name == "aussie:brebongsapling" then
minetest.log("action", "A sapling grows into a Brebong tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_tree(pos, random(1, 4) == 1)
else
default.grow_new_brebong_tree(pos)
end
end
2016-03-05 00:13:58: ERROR[Main]: ModError: Failed to load and run script from /home/cp/.minetest/mods/aussie/init.lua:
2016-03-05 00:13:58: ERROR[Main]: /home/cp/.minetest/mods/aussie/trees.lua:154: 'end' expected (to close 'function' at line 33) near '<eof>'
2016-03-05 00:13:58: ERROR[Main]: stack traceback:
2016-03-05 00:13:58: ERROR[Main]: [C]: in function 'dofile'
2016-03-05 00:13:58: ERROR[Main]: /home/cp/.minetest/mods/aussie/init.lua:3: in main chunk
2016-03-05 00:13:58: ERROR[Main]: Check debug.txt for details.
You might be intrested in my trees_lib mod. It allows you to easily add new trees. And if you intend to use the function (or schematic) used by existing trees, it won't be much extra work.