semicolons in names (valid?)

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

semicolons in names (valid?)

Post by Honktown »

I ran into a "bug" where I assumed semicolons weren't valid in names/identifiers (just word characters, hyphens, underscores, the lua definition of things). Figured I would ask here, if anyone knew whether or not semicolons were supposed to be "valid" in names/categories/etc; if there were any solid definition anywhere.
I have mods! I guess!
Link

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: semicolons in names (valid?)

Post by PyroFire »

https://www.lua.org/pil/1.1.html
A semicolon may optionally follow any statement. Usually, I use semicolons only to separate two or more statements written in the same line, but this is just a convention. Line breaks play no role in Lua's syntax; for instance, the following four chunks are all valid and equivalent:

a = 1
b = a*2

a = 1;
b = a*2;

a = 1 ; b = a*2

a = 1 b = a*2 -- ugly, but valid

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: semicolons in names (valid?)

Post by Honktown »

PyroFire wrote:
Thu Nov 28, 2019 4:27 am
https://www.lua.org/pil/1.1.html
I can look up how lua handles things, but Factorio will handle things its own way. I'm hoping there's a Factorio reference and not "if it works it's valid"
I have mods! I guess!
Link

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: semicolons in names (valid?)

Post by PyroFire »

Strings dont matter.
Semicolons and practically anything can be used as a prototype name.

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

Re: semicolons in names (valid?)

Post by Bilka »

https://wiki.factorio.com/PrototypeBase#name wrote: May not contain ., may not exceed a length of 200 characters.
Those are the only restrictions given by Factorio.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: semicolons in names (valid?)

Post by eradicator »

Bilka wrote:
Thu Nov 28, 2019 7:36 am
https://wiki.factorio.com/PrototypeBase#name wrote: May not contain ., may not exceed a length of 200 characters.
Those are the only restrictions given by Factorio.
Now i wonder, is that 200 characters or 200 bytes? Some languages have multi-byte characters ;)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: semicolons in names (valid?)

Post by Honktown »

eradicator wrote:
Thu Nov 28, 2019 7:14 pm
Bilka wrote:
Thu Nov 28, 2019 7:36 am
https://wiki.factorio.com/PrototypeBase#name wrote: May not contain ., may not exceed a length of 200 characters.
Those are the only restrictions given by Factorio.
Now i wonder, is that 200 characters or 200 bytes? Some languages have multi-byte characters ;)
You. Cut that shit out. I had to rewrite a function because I needed to empty a table and instead assigned the local variable to the empty table. It's bad enough using pairs() over a table you're modifying is undefined behavior.
I have mods! I guess!
Link

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: semicolons in names (valid?)

Post by eradicator »

Honktown wrote:
Thu Nov 28, 2019 9:03 pm
eradicator wrote:
Thu Nov 28, 2019 7:14 pm
Bilka wrote:
Thu Nov 28, 2019 7:36 am
https://wiki.factorio.com/PrototypeBase#name wrote: May not contain ., may not exceed a length of 200 characters.
Those are the only restrictions given by Factorio.
Now i wonder, is that 200 characters or 200 bytes? Some languages have multi-byte characters ;)
You. Cut that shit out. I had to rewrite a function because I needed to empty a table and instead assigned the local variable to the empty table. It's bad enough using pairs() over a table you're modifying is undefined behavior.
I have no fucking clue what you're talking about. But please calm down.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 883
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: semicolons in names (valid?)

Post by Oktokolo »

eradicator wrote:
Thu Nov 28, 2019 7:14 pm
Now i wonder, is that 200 characters or 200 bytes? Some languages have multi-byte characters ;)
You probably mean grapheme clusters.
Who would care about single code points anyway...
8-)

Post Reply

Return to “Modding discussion”