Page 1 of 1
[0.17.24] Mod loader load comments
Posted: Thu Apr 04, 2019 4:03 pm
by Patus
When loading mod it load comments. example
data:extend(
{
--[[
{
type = "tool",
name = "testTool",
icon = "__base__/graphics/icons/science-pack-1.png",
icon_size=32,
subgroup = "science-pack",
order = "a[science-pack-1]",
stack_size = 200,
durability = 10,
},
--]]
})
when you try start game it throw error "Failed to load mods: File not found:__base__/graphics/icons/science-pack-1.png
Re: [0.17.24] Mod loader load comments
Posted: Thu Apr 04, 2019 6:50 pm
by Bilka
No, it does not. I can copy paste your code and it will result in the expected error (invalid prototype array), not the error that you describe. Moving this to modding help.
Re: [0.17.24] Mod loader load comments
Posted: Thu Apr 04, 2019 8:01 pm
by Patus
Ok i solved it. If start 2x multiline comment and put ]] comment stop but editor show comment continue.

Re: [0.17.24] Mod loader load comments
Posted: Fri Apr 05, 2019 1:19 pm
by bobingabout
opens a comment block
is LUA to close a comment block
factorio usually uses this to close a comment block
starts a comment
does nothing as you've written a comment block closer, as a comment.
Re: [0.17.24] Mod loader load comments
Posted: Fri Apr 05, 2019 5:43 pm
by Trebor
bobingabout wrote: Fri Apr 05, 2019 1:19 pm
does nothing as you've written a comment block closer, as a comment.
Lua has nested comments?! A comment within a block comment disables the end of the block from being recognized?
Re: [0.17.24] Mod loader load comments
Posted: Fri Apr 05, 2019 7:03 pm
by eduran
bobingabout wrote: Fri Apr 05, 2019 1:19 pm
does nothing as you've written a comment block closer, as a comment.
That is not true. ]] will always close a block comment, even if it is commented out itself. There is actually a good reason to use --]] instead of ]] to close comments:
Code: Select all
--[[
game.print("Hello World!") -- this line is skipped
--]]
game.print("Hello again!") -- this will print
Now you can do this to disable your block comment without removing it completely:
Code: Select all
---[[ three hyphens
game.print("Hello World!") -- this will print
--]] this does not cause a syntax error because ]] is commented out
game.print("Hello again!") -- this will also print