[0.17.24] Mod loader load comments

Place to get help with not working mods / modding interface.
Post Reply
Patus
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Jan 27, 2016 2:46 pm
Contact:

[0.17.24] Mod loader load comments

Post 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

Bilka
Factorio Staff
Factorio Staff
Posts: 3128
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.17.24] Mod loader load comments

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Patus
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Jan 27, 2016 2:46 pm
Contact:

Re: [0.17.24] Mod loader load comments

Post by Patus »

Ok i solved it. If start 2x multiline comment and put ]] comment stop but editor show comment continue.

Image

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.17.24] Mod loader load comments

Post by bobingabout »

Code: Select all

--[[
opens a comment block

Code: Select all

]]
is LUA to close a comment block

Code: Select all

]]--
factorio usually uses this to close a comment block

Code: Select all

--
starts a comment

Code: Select all

--]]
does nothing as you've written a comment block closer, as a comment.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Trebor
Filter Inserter
Filter Inserter
Posts: 288
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: [0.17.24] Mod loader load comments

Post by Trebor »

bobingabout wrote:
Fri Apr 05, 2019 1:19 pm

Code: Select all

--]]
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?

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: [0.17.24] Mod loader load comments

Post by eduran »

bobingabout wrote:
Fri Apr 05, 2019 1:19 pm

Code: Select all

--]]
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 

Post Reply

Return to “Modding help”