So, I want to make a mod with many nodes. And I don't want to write code the traditional way because it would make me waste time and space. So, based on a solution 12Me21 found for one of my other mods, I make a noob "theory".
So this is the code I write to sample.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local fencenames={"white","red","darkred","orange","indigo","gold","yellow","lime",}
minetest.register_node("madfences:"..fencenames, {
tiles = {"madfences_"..fencenames..".png"},
})
But it doesn't work! It makes the game crash on start. I've tried everything that came to my head as worth trying!
Here's the error message on debug.txt
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
Irrlicht log: Irrlicht Engine version 1.8.1
Irrlicht log: Microsoft Windows 7 Ultimate Edition Service Pack 1 (Build 7601)
Irrlicht log: Using renderer: OpenGL 2.1.2
Irrlicht log: GeForce 6150SE nForce 430/integrated/SSE2: NVIDIA Corporation
Irrlicht log: OpenGL driver version is 1.2 or better.
Irrlicht log: GLSL version: 1.2
Irrlicht log: Resizing window (800 600)
16:59:30: ERROR[main]: mod "dropper" has unsatisfied dependencies: "nuke"
16:59:30: ERROR[main]: The following mods could not be found: "locale" "machines" "sounds" "textures" "tools"
16:59:30: WARNING: Undeclared global variable "worldedit" accessed at ...\Minetest 0.4.12\bin\..\mods\worldedit/manipulations.lua:1
16:59:30: ERROR[main]: ========== ERROR FROM LUA ===========
16:59:30: ERROR[main]: Failed to load and run script from
16:59:30: ERROR[main]: D:\ABNew\Minetest 0.4.12\bin\..\mods\madfences\init.lua:
16:59:30: ERROR[main]: D:\ABNew\Minetest 0.4.12\bin\..\mods\madfences\init.lua:3: attempt to concatenate local 'fencenames' (a table value)
16:59:30: ERROR[main]: stack traceback:
16:59:30: ERROR[main]: D:\ABNew\Minetest 0.4.12\bin\..\mods\madfences\init.lua:3: in main chunk
16:59:30: ERROR[main]: ======= END OF ERROR FROM LUA ========
16:59:30: ERROR[main]: Server: Failed to load and run D:\ABNew\Minetest 0.4.12\bin\..\mods\madfences\init.lua
16:59:30: ERROR[main]: ModError: ModError: Failed to load and run D:\ABNew\Minetest 0.4.12\bin\..\mods\madfences\init.lua
Please help me solve this error and write efficient code for mod :) I am a noob