This error is perplexing me. Someone please help!

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

This error is perplexing me. Someone please help!

by Winter94 » Wed Jan 22, 2020 02:37

This error:
2020-01-21 20:15:14: ERROR[Main]: ...est-5.1.0-win64\bin\..\mods\underforge_main/worldgen.lua:468: unexpected symbol near '['
I am working on custom stone/cave biome generation based on code from the UnderChallenge mod.
The error is perplexing because this is what is causing the error:

--Lava
[60] = function(x, y, z, vi, data, p2data, area, lastlayer) --THIS IS LINE 468--
stonebeard.use_stone(vi, data, "pumice")
stonebeard.functions.replace(vi, data, c_air, c_lava)
end,
this is formatted just like every other biome definition in the worldgen.lua file, I even completely retyped it out and it still errors. What have I done wrong?
 

User avatar
GreenXenith
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenXenith
In-game: GreenXenith

Re: This error is perplexing me. Someone please help!

by GreenXenith » Wed Jan 22, 2020 03:13

Without the surrounding context, I am guessing you are using the table key notation ([index] = value) outside of a table. That is only valid when defining a table. I don't understand why the key is 60, because numbered keys don't require explicit notation (not important though).

If you change the [60] = function( to something like local myFunction = function(, it will likely solve the issue. At that point it will probably complain about the comma after your end statement, which is also only valid inside table definitions (so remove it).
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: This error is perplexing me. Someone please help!

by Winter94 » Wed Jan 22, 2020 03:26

The value is 60 because the worldgen uses an equation based on depth, pressure, darkness, tempurature, etc, and calculates what biome to generate there. The answer to the equation is always between 1 and 62, so there are exactly 62 biomes. it picks the biome with the number that matches the product of the equation.
 

User avatar
GreenXenith
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenXenith
In-game: GreenXenith

Re: This error is perplexing me. Someone please help!

by GreenXenith » Wed Jan 22, 2020 05:19

Winter94 wrote:The value is 60 because the worldgen uses an equation based on depth, pressure, darkness, tempurature, etc, and calculates what biome to generate there.

Ah, I see.

Back to the actual error, the key-value pair makes sense in the context of a table, but your code snippet lacks surrounding context, so the best anyone can do is guess why it might be wrong. If you still haven't figured it out, more surrounding code would be helpful in determining the issue.
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

ShadMOrdre
Member
 
Posts: 596
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: This error is perplexing me. Someone please help!

by ShadMOrdre » Wed Jan 22, 2020 08:16

If the code snippet above is complete, the issue is that you have not provided the name of the table / array.

Code: Select all
[60] = function(x, y, z, vi, data, p2data, area, lastlayer)


has no context. Lua doesn't know indexes outside of the context of an array or table.

Code: Select all
your_table_name_here[60] = function(x, y, z, vi, data, p2data, area, lastlayer)


would be correct, where "your_table_name_here" is a reference to an actual table that you have already declared and instantiated in code.
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: This error is perplexing me. Someone please help!

by Winter94 » Wed Jan 22, 2020 13:33

As much as I hate to do this, because pasting huge blocks of code some say is bad manners, but here you go.
The line that is giving the error is
[60] = function(x, y, z, vi, data, p2data, area, lastlayer)
and it looks no different than any of the rest of it. it says unexpected character near '['
Here's the entire worldgen file as is currently sits:

-- used blocks
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")

local c_water = minetest.get_content_id("default:water_source")
local c_lava = minetest.get_content_id("default:lava_source")
local c_dirt = minetest.get_content_id("default:dirt")
local c_cobble = minetest.get_content_id("default:cobble")
local c_cobblestair = minetest.get_content_id("stairs:stair_cobble")
local c_coalblock = minetest.get_content_id("default:coalblock")

local c_dust = minetest.get_content_id("stonebeard:dust")
local c_coal_dust = minetest.get_content_id("stonebeard:coal_dust")

-----Mushrooms-----
local c_agaricus_bisporus = minetest.get_content_id("stonebeard:agaricus_bisporus")
local c_amanita_muscaria = minetest.get_content_id("stonebeard:amanita_muscaria")
local c_amanita_phalloides = minetest.get_content_id("stonebeard:amanita_phalloides")
local c_armillaria_mellea = minetest.get_content_id("stonebeard:armillaria_mellea")
local c_mycena_cholorophos = minetest.get_content_id("stonebeard:mycena_chlorophos")
local c_mycena_haematopus = minetest.get_content_id("stonebeard:mycena_haematopus")
local c_mycena_interrupta = minetest.get_content_id("stonebeard:mycena_interrupta")
local c_mycena_luxaeterna = minetest.get_content_id("stonebeard:mycena_luxaeterna")
local c_dark_tuber = minetest.get_content_id("stonebeard:dark_tuber")
-------------------
local c_mossy_dirt = minetest.get_content_id("stonebeard:mossy_dirt")
local c_torchberries = minetest.get_content_id("stonebeard:torchberries")
local c_moss = minetest.get_content_id("stonebeard:moss")
local c_dry_moss = minetest.get_content_id("stonebeard:dry_moss")
local c_underground_bush = minetest.get_content_id("stonebeard:underground_bush")
local c_dead_bush = minetest.get_content_id("stonebeard:dead_bush")
local c_mould = minetest.get_content_id("stonebeard:mould")
local c_underground_vine = minetest.get_content_id("stonebeard:underground_vine")

local c_amethyst_ore = minetest.get_content_id("stonebeard:amethyst_ore")
local c_amethyst_crystal = minetest.get_content_id("stonebeard:amethyst_crystal")
local c_emerald_ore = minetest.get_content_id("stonebeard:emerald_ore")
local c_emerald_crystal = minetest.get_content_id("stonebeard:emerald_crystal")
local c_ruby_ore = minetest.get_content_id("stonebeard:ryby_ore")
local c_ruby_crystal = minetest.get_content_id("stonebeard:ruby_crystal")
local c_sapphire_ore = minetest.get_content_id("stonebeard:saphire_ore")
local c_sapphire_crystal = minetest.get_content_id("stonebeard:saphire_crystal")
local c_aquamarine_ore = minetest.get_content_id("stonebeard:aquamarine_ore")
local c_aquamarine_crystal = minetest.get_content_id("stonebeard:aquamarine_crystal")
local c_quartz_ore = minetest.get_content_id("stonebeard:quartz_ore")
local c_quartz_crystal = minetest.get_content_id("stonebeard:quartz_crystal")
local c_topaz_ore = minetest.get_content_id("stonebeard:topaz_ore")
local c_topaz_crystal = minetest.get_content_id("stonebeard:topaz_crystal")
local c_onyx_ore = minetest.get_content_id("stonebeard:onyx_ore")
local c_onyx_crystal = minetest.get_content_id("stonebeard:onyx_crystal")


local c_fire = minetest.get_content_id("fire:permanent_flame")
local c_fiery_dust = minetest.get_content_id("stonebeard:fiery_dust")
local c_fiery_vine = minetest.get_content_id("stonebeard:fiery_vine")
local c_lava_crack = minetest.get_content_id("stonebeard:lava_crack")

local c_quartz_block = minetest.get_content_id("stonebeard:quartz_block")
local c_aquamarine_block = minetest.get_content_id("stonebeard:aquamarine_block")
local c_amethyst_block = minetest.get_content_id("stonebeard:amethyst_block")

local c_basalt = minetest.get_content_id("stonebeard:basalt")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_pumice = minetest.get_content_id("stonebeard:pumice")
local c_volcanic_tuff = minetest.get_content_id("stonebeard:volcanic_tuff")

--[[local c_amphibolite = minetest.get_content_id("stonebeard:amphibolite")
local c_andesite = minetest.get_content_id("stonebeard:andesite")
local c_basalt = minetest.get_content_id("stonebeard:basalt")
local c_chalk = minetest.get_content_id("stonebeard:chalk")
local c_chert = minetest.get_content_id("stonebeard:chert")
local c_diorite = minetest.get_content_id("stonebeard:diorite")
local c_dolomite = minetest.get_content_id("stonebeard:dolomite")
local c_feldspar = minetest.get_content_id("stonebeard:feldspar")
local c_flint = minetest.get_content_id("stonebeard:flint")
local c_gabbro = minetest.get_content_id("stonebeard:gabbro")
local c_gneiss = minetest.get_content_id("stonebeard:gneiss")
local c_granite = minetest.get_content_id("stonebeard:granite")
local c_jasper = minetest.get_content_id("stonebeard:jasper")
local c_kimberlite = minetest.get_content_id("stonebeard:kimberlite")
local c_limestone = minetest.get_content_id("stonebeard:limestone")
local c_marble = minetest.get_content_id("stonebeard:marble")
local c_mica = minetest.get_content_id("stonebeard:mica")
local c_olivine = minetest.get_content_id("stonebeard:olivine")
local c_pegmatite = minetest.get_content_id("stonebeard:pegmatite")
local c_phyllite = minetest.get_content_id("stonebeard:phyllite")
local c_pumice = minetest.get_content_id("stonebeard:pumice")
local c_quartzite = minetest.get_content_id("stonebeard:quartzite")
local c_schist = minetest.get_content_id("stonebeard:schist")
local c_shale = minetest.get_content_id("stonebeard:shale")
local c_slate = minetest.get_content_id("stonebeard:slate")
local c_volcanic_tuff = minetest.get_content_id("stonebeard:volcanic_tuff")--]]

function stonebeard.use_stone(vi, data, id)
stonebeard.functions.replace(vi, data, c_stone, stonebeard.stone.defs[id].base)
stonebeard.functions.replace(vi, data, c_cobble, stonebeard.stone.defs[id].cobble)
stonebeard.functions.replace(vi, data, c_cobblestair, stonebeard.stone.defs[id].stair)
end


---------- Biome Definitions ----------

stonebeard.biomegen = {
--Dolomite
[1] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "dolomite")
end,
--Limestone
[2] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "limestone")
end,
--Schist
[3] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "schist")
end,
--Andesite
[4] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "andesite")
end,
--Phyllite
[5] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "phyllite")
end,
--Quartzite
[6] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "quartzite")
end,
--Mica
[7] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "mica")
end,
--Slate
[8] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "slate")
end,
--Gneiss
[9] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "gneiss")
end,
--Chalk
[10] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "chalk")
end,
--Feldspar
[11] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "feldspar")
end,
--Basalt
[12] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "basalt")
end,
--Diorite
[13] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "diorite")
end,
--Chert
[14] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "chert")
end,
--Granite
[15] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "granite")
end,
--Gabbro
[16] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "gabbro")
end,
--Dolomite Cave
[17] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "dolomite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["dolomite"].base, c_water, 1/2000)
end,
--Limestone Dust
[18] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "limestone")
stonebeard.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_dust, 1, stonebeard.stone.defs["limestone"].base)
end,
--Coal
[19] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "shale")
stonebeard.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_coal_dust, 1/9, stonebeard.stone.defs["shale"].base)
--stonebeard.functions.ore(vi, data, stonebeard.stone.defs["shale"].base, c_coal_dust, 1/9)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["shale"].base, c_coal_ore, 1/201)
end,
--Marble
[20] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "marble")
end,
--Fungi
[21] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "amphibolite")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/18, stonebeard.stone.defs["amphibolite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/18, stonebeard.stone.defs["amphibolite"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, stonebeard.stone.defs["amphibolite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_water, 1/2000)
end,
--Torchberries
[22] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "jasper")
stonebeard.functions.on_roof(x, y, z, vi, area, data, c_stone, c_air, c_torchberries, 1/30, lastlayer, stonebeard.stone.defs["jasper"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/18, stonebeard.stone.defs["jasper"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["jasper"].base, c_water, 1/2000)
end,
--Tubers
[23] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "pegmatite")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/18, stonebeard.stone.defs["pegmatite"].base)
stonebeard.functions.on_floor_rr(x, y, z, vi, area, data, p2data, c_stone, c_air, c_dark_tuber, 1/50, stonebeard.stone.defs["pegmatite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pegmatite"].base, c_coal_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pegmatite"].base, c_water, 1/2000)
end,
--Jasper & Flint
[24] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "jasper")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["flint"].base, 1/50)
end,
--Quartz
[25] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "quartzite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, stonebeard.stone.defs["quartzite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["quartzite"].base, c_water, 1/2000)
end,
--Emerald
[26] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "olivine")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_green_mushroom, 1/18, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["olivine"].base, c_emerald_ore, 1/201)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, stonebeard.stone.defs["olivine"].base)
end,
--Moss
[27] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "basalt")
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_moss, 1/3, lastlayer, stonebeard.stone.defs["basalt"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_dirt, c_air, c_moss, 1/3, lastlayer)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/18, stonebeard.stone.defs["basalt"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["basalt"].base, c_water, 1/2000)
end,
--Flint
[28] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "flint")
end,
--Feldspar 2
[29] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "feldspar")
end,
--Mica 2
[30] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "mica")
end,
--Torchberry Jungle
[31] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "granite")
stonebeard.functions.on_roof(x, y, z, vi, area, data, c_stone, c_air, c_torchberries, 1/30, lastlayer, stonebeard.stone.defs["granite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, stonebeard.stone.defs["granite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, stonebeard.stone.defs["granite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, stonebeard.stone.defs["granite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, stonebeard.stone.defs["granite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["granite"].base, c_mossy_dirt, 1/100)
end,
--Fungus Jungle
[32] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "andesite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["andesite"].base, c_mossy_dirt, 1/100)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, stonebeard.stone.defs["andesite"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["andesite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, stonebeard.stone.defs["andesite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, stonebeard.stone.defs["andesite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, stonebeard.stone.defs["andesite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, stonebeard.stone.defs["andesite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["andesite"].base, c_water, 1/2000)
end,
--Lava Springs
[33] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "marble")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["marble"].base, c_lava, 1/2000)
end,
--Fungus Jungle 2
[32] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "olivine")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["olivine"].base, c_mossy_dirt, 1/100)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_moss, 1/9, lastlayer, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_interrupta, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, stonebeard.stone.defs["olivine"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["olivine"].base, c_water, 1/2000)
end,
--Gneiss 2
[35] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "gneiss")
end,
--Coal 2
[36] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "shale")
stonebeard.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_coal_dust, 1/9, stonebeard.stone.defs["shale"].base)
--stonebeard.functions.ore(vi, data, stonebeard.stone.defs["shale"].base, c_coal_dust, 1/9)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["shale"].base, c_coal_ore, 1/201)
end,
--Fungi 2
[37] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "phyllite")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/40, stonebeard.stone.defs["phyllite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/40, stonebeard.stone.defs["phyllite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/20, stonebeard.stone.defs["phyllite"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/20, stonebeard.stone.defs["phyllite"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, stonebeard.stone.defs["phyllite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["phyllite"].base, c_water, 1/2000)
end,
--Volcanic
[38] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "volcanic_tuff")
stonebeard.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_obsidian, 1/50, stonebeard.stone.defs["volcanic_tuff"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_fiery_dust, 1/13)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/18, stonebeard.stone.defs["volcanic_tuff"].base)
end,
--Quartz 2
[25] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "quartzite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, stonebeard.stone.defs["quartzite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["quartzite"].base, c_water, 1/2000)
end,
--Schist 2
[40] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "schist")
end,
--Amethyst & Sapphire
[41] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "gabbro")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_interrupta, 1/18, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gabbro"].base, c_sapphire_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gabbro"].base, c_amethyst_ore, 1/201)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gabbro"].base, c_water, 1/2000)
end,
--Ruby Caves
[42] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "jasper")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, stonebeard.stone.defs["jasper"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["jasper"].base, c_ruby_ore, 1/201)
stonebeard.functions.in_floor(x, y, z, vi, area, data, c_air, c_stone, c_ruby_dust, 1/450, stonebeard.stone.defs["jasper"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, stonebeard.stone.defs["jasper"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["jasper"].base, c_water, 1/2000)
end,
--Phyllite 2
[43] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "phyllite")
end,
--Chert 2
[44] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "chert")
end,
--Quartz 3
[45] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "quartzite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, stonebeard.stone.defs["quartzite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["quartzite"].base, c_water, 1/2000)
end,
--Aquamarine & Amethyst
[46] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "diorite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["diorite"].base, c_aquamarine_ore, 1/50)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_aquamarine_crystal, 1/50, lastlayer, stonebeard.stone.defs["diorite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["diorite"].base, c_amethyst_ore, 1/50)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/50, lastlayer, stonebeard.stone.defs["diorite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["diorite"].base, c_water, 1/2000)
end,
--Pegmatite 2
[47] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "pegmatite")
end,
--Lava Jungle
[48] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "gabbro")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gabbro"].base, c_mossy_dirt, 1/100)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/18, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gabbro"].base, c_lava, 1/5000)
end,
--Slate 2
[49] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "slate")
end,
--Diamonds
[50] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "kimberlite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
stonebeard.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["kimberlite"].base, c_lava, 1/1000)
end,
--Lava Jungle 2
[51] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "mica")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["mica"].base, c_mossy_dirt, 1/100)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, stonebeard.stone.defs["mica"].base)
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/18, stonebeard.stone.defs["mica"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["mica"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["mica"].base, c_lava, 1/5000)
end,
--Copper
[52] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "gneiss")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gneiss"].base, c_copper_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["gneiss"].base, c_lava, 1/1000)
end,
--Hot Slate
[53] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "slate")
stonebeard.functions.ore(vi, data, c_obsidian, c_lava, 1/1000)
end,
--Chalk 2
[54] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "chalk")
end,
--Wet Mica
[55] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "mica")
stonebeard.functions.replace(vi, data, c_air, c_water)
end,
--Emerald 2
[56] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "mica")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/18, stonebeard.stone.defs["mica"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["mica"].base, c_emerald_ore, 1/201)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, stonebeard.stone.defs["mica"].base)
end,
--Diamonds
[57] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "kimberlite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
stonebeard.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["kimberlite"].base, c_lava, 1/1000)
end,
--Crystal Caves
[58] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "amphibolite")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, stonebeard.stone.defs["amphibolite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_sapphire_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_amethyst_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_quartz_ore_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_emerald_ore_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_ruby_ore, 1/201)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_water, 1/2000)
--Volcanic Granite
[59] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "granite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["granite"].base, c_obsidian, 1/200)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_lava, 1/300)
end,
--Lava
[60] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "pumice")
stonebeard.functions.replace(vi, data, c_air, c_lava)
end,
--Volcanic Basalt
[61] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "basalt")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["basalt"].base, c_obsidian, 1/200)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_lava, 1/300)
end,
--Volcanic Tuff
[62] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.functions.replace(vi, data, c_stone, c_volcanic_tuff)
stonebeard.functions.replace(vi, data, c_cobble, c_volcanic_tuff)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["volcanic_tuff"].base, c_obsidian, 1/100)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_lava, 1/300)
stonebeard.functions.replace(vi, data, c_air, c_lava)
stonebeard.use_stone(vi, data, "volcanic_tuff")
end,
}

local np_darkness = {
offset = 0,
scale = 1,
spread = {x=200, y=200, z=200},
seed = 6830,
octaves = 3,
persist = 0.5
}

local np_water = {
offset = 0,
scale = 1,
spread = {x=200, y=200, z=200},
seed = 6831,
octaves = 3,
persist = 0.5
}

local np_pressure = {
offset = 0,
scale = 1,
spread = {x=200, y=200, z=200},
seed = 6832,
octaves = 3,
persist = 0.5
}

minetest.register_on_generated(function(minp, maxp, seed)

--easy reference to commonly used values
--local t1 = os.clock()
local x1 = maxp.x
local y1 = maxp.y
local z1 = maxp.z
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z

local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local data = vm:get_data()
local p2data = vm:get_param2_data()

--mandatory values
local sidelen = x1 - x0 + 1 --length of a mapblock
local chulens = {x=sidelen, y=sidelen, z=sidelen} --table of chunk edges
local chulens2D = {x=sidelen, y=sidelen, z=1}
local minposxyz = {x=x0, y=y0, z=z0} --bottom corner
local minposxz = {x=x0, y=z0} --2D bottom corner

local nvals_darkness = minetest.get_perlin_map(np_darkness, chulens):get3dMap_flat(minposxyz)
local nvals_water = minetest.get_perlin_map(np_water, chulens):get3dMap_flat(minposxyz)
local nvals_pressure = minetest.get_perlin_map(np_pressure, chulens):get3dMap_flat(minposxyz)

local nixyz = 1 --3D node index
local nixz = 1 --2D node index
local nixyz2 = 1 --second 3D index for second loop


for z = z0, z1 do -- for each xy plane progressing northwards
--increment indices
nixyz = nixyz + 1

for y = y0, y1 do -- for each x row progressing upwards

local vi = area:index(x0, y, z)
for x = x0, x1 do -- for each node do

local darkness = nvals_darkness[nixyz2]
local water = nvals_water[nixyz2]
local pressure = stonebeard.functions.get_pressure(y, nvals_pressure[nixyz2])

--[[if y > -100 then -- limit the biome variety near surface
darkness = -0.01*y*darkness - 1 - 0.01*y
water = -0.01*y*water - 1 - 0.01*y
end--]]
local biome = stonebeard.functions.get_biome(darkness, water, pressure) + 1

if (biome < 1) or (biome > 62) then
print(string.format("Wrong biome %i", biome))
biome = 1
end

stonebeard.biomegen[biome](x, y, z, vi, data, p2data, area, y == y1)

nixyz2 = nixyz2 + 1
nixz = nixz + 1
vi = vi + 1
end
nixz = nixz - sidelen --shift the 2D index back
end
nixz = nixz + sidelen --shift the 2D index up a layer
end

--send data back to voxelmanip
vm:set_data(data)
vm:set_param2_data(p2data)
--calc lighting
vm:set_lighting({day=0, night=0})
vm:calc_lighting()
--write it to world
vm:write_to_map(data)

--local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took
--print ("[caverealms] "..chugent.." ms") --tell people how long
end)
 

ShadMOrdre
Member
 
Posts: 596
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: This error is perplexing me. Someone please help!

by ShadMOrdre » Wed Jan 22, 2020 17:05

Winter94,

In this code snippet, taken from above, I can see that at the end of [58], you do not have 'end,', so lua interprets that [58] and [59] are a single index.

This should solve the issue. I would encourage you to double check syntax.

Also, you can embed code in a nifty little box like here, by using the code button above, which will provide tags in which you can place the code block, and have it nicely formatted.

Code: Select all
--Emerald 2
[56] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "mica")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/18, stonebeard.stone.defs["mica"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["mica"].base, c_emerald_ore, 1/201)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, stonebeard.stone.defs["mica"].base)
end,
--Diamonds
[57] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "kimberlite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
stonebeard.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["kimberlite"].base, c_lava, 1/1000)
end,
--Crystal Caves
[58] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "amphibolite")
stonebeard.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, stonebeard.stone.defs["amphibolite"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_sapphire_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_amethyst_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_quartz_ore_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_emerald_ore_ore, 1/201)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_ruby_ore, 1/201)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, stonebeard.stone.defs["gabbro"].base)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["amphibolite"].base, c_water, 1/2000)
--Volcanic Granite
[59] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "granite")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["granite"].base, c_obsidian, 1/200)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_lava, 1/300)
end,
--Lava
[60] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "pumice")
stonebeard.functions.replace(vi, data, c_air, c_lava)
end,
--Volcanic Basalt
[61] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.use_stone(vi, data, "basalt")
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["basalt"].base, c_obsidian, 1/200)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_lava, 1/300)
end,
--Volcanic Tuff
[62] = function(x, y, z, vi, data, p2data, area, lastlayer)
stonebeard.functions.replace(vi, data, c_stone, c_volcanic_tuff)
stonebeard.functions.replace(vi, data, c_cobble, c_volcanic_tuff)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["volcanic_tuff"].base, c_obsidian, 1/100)
stonebeard.functions.ore(vi, data, stonebeard.stone.defs["pumice"].base, c_lava, 1/300)
stonebeard.functions.replace(vi, data, c_air, c_lava)
stonebeard.use_stone(vi, data, "volcanic_tuff")
end,



Hope this helps.


Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: This error is perplexing me. Someone please help!

by Winter94 » Wed Jan 22, 2020 17:23

thank you very much, it fixed it. i cant believe i didnt notice that, i was staring at that file for ages.
 

ShadMOrdre
Member
 
Posts: 596
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: This error is perplexing me. Someone please help!

by ShadMOrdre » Wed Jan 22, 2020 17:34

For the record, that error almost ALWAYS means a typo or omission. It hits me more than I care to admit.


Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

User avatar
GreenXenith
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenXenith
In-game: GreenXenith

Re: This error is perplexing me. Someone please help!

by GreenXenith » Wed Jan 22, 2020 17:59

If you use an IDE such as Visual Studio Code, Sublime Text, or Atom, I suggest you set up an auto-linter to help catch issues like this. See the Automatic Error Checking section in Rubenwardy's Modding Book.

Also, please mark the thread title as [SOLVED] ;)
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: This error is perplexing me. Someone please help!

by Winter94 » Thu Jan 23, 2020 01:46

Actually, as much as some may judge me, I prefer using Notepad++ for all of my coding [which generally is either working on my minetest mods that will eventually become a cohesive game, or modding Dwarf Fortress]. It handles most programming languages, has a simple but intuitive interface, and is free with no strings.
 

ThorfinnS
Member
 
Posts: 221
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: This error is perplexing me. Someone please help!

by ThorfinnS » Thu Jan 23, 2020 03:10

Compare, LuaScript, Snippets, SurroundSelection, XBracketsLite.

What else?
 

ShadMOrdre
Member
 
Posts: 596
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: This error is perplexing me. Someone please help!

by ShadMOrdre » Thu Jan 23, 2020 04:34

I prefer the ease of use that comes with Notepad++, but have abandoned Windows in favor of Lubuntu. Alas, there is no Notepad++ for Linux, or I just haven't stumbled upon it... :(

Sad, since it is based on Scintilla.

Open to suggestions for a quality text editor or IDE, that is not vim, emacs, or some other "bloated" editor that is overkill for simple MT lua modding.


Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

User avatar
rubenwardy
Moderator
 
Posts: 6019
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: This error is perplexing me. Someone please help!

by rubenwardy » Thu Jan 23, 2020 19:47

You don't need to use LuaCheck with an editor, you can use it as an external tool

ShadMOrdre wrote:Open to suggestions for a quality text editor or IDE, that is not vim, emacs, or some other "bloated" editor that is overkill for simple MT lua modding.


VSCodium :) Linting and tools like "goto symbol" are not overkill. It's also heavily plugin based, so you can uninstall the features you don't like
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: This error is perplexing me. Someone please help!

by Winter94 » Thu Jan 23, 2020 19:54

Speaking of checking code, anyone know what is wrong with this?
Code: Select all
underforge.minerals = {}

local mineral_list(name, desc, strata, rarity,) = {
   {"corundum",      "Corundum",         "gneiss",         [10*10*10],},
   {"corundum",      "Corundum",         "mica",            [10*10*10],},
   {"corundum",      "Corundum",         "schist",         [10*10*10],},
   {"corundum",      "Corundum",         "pegmatite",      [10*10*10],},
   {"tetrahedrite",   "Tetrahedrite",      "diorite",         [10*10*10],},
   {"tetrahedrite",   "Tetrahedrite",      "pegmatite",      [10*10*10],},
   {"tetrahedrite",   "Tetrahedrite",      "phyllite",         [10*10*10],},
   {"cassiterite",      "Cassiterite",      "andesite",         [10*10*10],},
   {"cassiterite",      "Cassiterite",      "basalt",         [10*10*10],},
   {"cassiterite",      "Cassiterite",      "gabbro",         [10*10*10],},
   }

local function register_ore(name, desc, strata, rarity, texture)
   local ore = {
      name = "underforge:"..name,
      description = desc,
      drop = "underforge:"..name.."_chunk",
      wherein = strata,
      clust_scarcity = rarity,
      clust_size = 5,
      clust_num_ores = 10,
      tiles = {strata..".png" ^ "ore_"..name..".png"},
      groups = {stone=1, minerals=1},
   }
end

   minetest.register_craftitem("underforge:"..name, {
      description = ("Chunk of" ..desc ),
      inventory_image = "chunk_"..name..".png",
   })
 

User avatar
rubenwardy
Moderator
 
Posts: 6019
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: This error is perplexing me. Someone please help!

by rubenwardy » Thu Jan 23, 2020 20:01

the square braces at the end of the line are wrong:

Code: Select all
{"corundum",      "Corundum",         "mica",            [10*10*10],},


is it supposed to be a table or an integer?

for integer:

Code: Select all
{"corundum",      "Corundum",         "mica",            10*10*10,},


for table:

Code: Select all
{"corundum",      "Corundum",         "mica",            {10*10*10},},


The [] notation is only for table keys, you don't need it for number values
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: This error is perplexing me. Someone please help!

by Winter94 » Fri Jan 24, 2020 02:04

Thanks, I fixed that, but it still says
ERROR[Main]: ...est-5.1.0-win64\bin\..\mods\underforge_lite/minerals.lua:3: ')' expected near ','
and i dont know what...i did wrong.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 9 guests