Page 1 of 1
semicolons in names (valid?)
Posted: Thu Nov 28, 2019 4:04 am
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.
Re: semicolons in names (valid?)
Posted: Thu Nov 28, 2019 4:27 am
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
Re: semicolons in names (valid?)
Posted: Thu Nov 28, 2019 4:28 am
by Honktown
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"
Re: semicolons in names (valid?)
Posted: Thu Nov 28, 2019 4:29 am
by PyroFire
Strings dont matter.
Semicolons and practically anything can be used as a prototype name.
Re: semicolons in names (valid?)
Posted: Thu Nov 28, 2019 7:36 am
by Bilka
Those are the only restrictions given by Factorio.
Re: semicolons in names (valid?)
Posted: Thu Nov 28, 2019 7:14 pm
by eradicator
Bilka wrote: Thu Nov 28, 2019 7:36 am
Those are the only restrictions given by Factorio.
Now i wonder, is that 200 characters or 200 bytes? Some languages have multi-byte characters ;)
Re: semicolons in names (valid?)
Posted: Thu Nov 28, 2019 9:03 pm
by Honktown
eradicator wrote: Thu Nov 28, 2019 7:14 pm
Bilka wrote: Thu Nov 28, 2019 7:36 am
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.
Re: semicolons in names (valid?)
Posted: Fri Nov 29, 2019 12:19 am
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
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.
Re: semicolons in names (valid?)
Posted: Fri Nov 29, 2019 5:14 am
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...