476 below was in a --[[comment]]--, fully greened-out txt in Notepad++, and copied fully from a game talent, even, the whole talent to test something that didnt work, so I made it a comment while trying stuff, but it still killed it.
How can a COMMENT prevent the entire game from loading? what does the --[[...]]-- do if what is inside can still kill the game? I t was totally greened out and clicking on one bracket made both red, so it was totally inside the bracket.
Yet I see mods like the xorn mod where there is code left unused inside --[[...]]--, so I thought that meant the game would ignore it like a comment. What gives here?
Lua Error: /engine/utils.lua /data-Chrono-Xorn/talents/Chrono-Xorn.lua:476: unexpected symbol near ')'
At [C]:-1
At [C]:-1 error
At /engine/utils.lua:1782 loadfilemods
At /engine/interface/ActorTalents.lua:31 loadDefinition
At /hooks/Chrono-Xorn/load.lua:10
At [string "return function(l, self, data) local ok=false..."]:1
At /mod/load.lua:271
At [C]:-1 require
At /engine/Module.lua:160 load
At /engine/Module.lua:955 instanciate
At /engine/utils.lua:2197 showMainMenu
At /engine/init.lua:162
At [C]:-1 dofile
At /loader/init.lua:204
i had erased it, but what I have found is, take any talent that works, put --[[ ]]-- around it, and the brackets already in it will cause an error that prevents loading, for example:
--[[
newTalent{
short_name = "TELEPORT_POINT_0",
name = "Timeport: Point 0",
image = "talents/teleport_point_zero.png",
type = {"race/Chrono_Xorn", 1},
cooldown = 400,
no_npc_use = true,
no_unlearn_last = true,
no_silence=true, is_spell=true,
action = function(self, t)
if not self:canBe("worldport") or self:attr("never_move") then
game.logPlayer(self, "The spell fizzles...")
return
end
local seen = false
-- Check for visible monsters, only see LOS actors, so telepathy wont prevent it
core.fov.calc_circle(self.x, self.y, game.level.map.w, game.level.map.h, 20, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y)
local actor = game.level.map(x, y, game.level.map.ACTOR)
if actor and actor ~= self then
if actor.summoner and actor.summoner == self then
seen = false
else
seen = true
end
end
end, nil)
if seen then
game.log("There are creatures that could be watching you; you cannot take the risk.")
return
end
self:setEffect(self.EFF_TELEPORT_POINT_ZERO, 40, {})
self:attr("temporal_touched", 1)
self:attr("time_travel_times", 1)
return true
end,
info = [[Allows a chronomancer to timeport to Point Zero.
You have studied the chronomancy there and have been granted a special portal spell to teleport there.
Nobody must learn about this spell and so it should never be used while seen by any creatures.
The spell will take time to activate. You must be out of sight of any creature when you cast it and when the timeportation takes effect.]]
}
]]--
And what causes the error is the brackets around txt at the end:
[[Allows a chronomancer to timeport to Point Zero.
You have studied the chronomancy there and have been granted a special portal spell to teleport there.
Nobody must learn about this spell and so it should never be used while seen by any creatures.
The spell will take time to activate. You must be out of sight of any creature when you cast it and when the timeportation takes effect.]]
if I do the same thing for any talent I did this with but delete them and just -- the txt then it works.
like this talent:
info = function(self)
return
--When you kill a creature, you have a 50 percent chance to summon its clone from another timeline, one that is more likely to survive.
end,
}
if I left the brackets normally there instead of removing them, it would break the game even though its in a comment.
i think some other stuff does it also. is there a different kind of comment brackets that will stop this bug from happening? really should not be crashing the game from code its told to ignore.
Lua doesn't parse nested comments/strings. So the --[[ comment starter ends at the ]] used to finish the info block.
Lua lets you stick = inside of them to differentiate. So a --[==[ comment will only end at a ]==], and not at the ]] used for the string.