[0.14.19] All Number Usernames

This subforum contains all the issues which we already resolved.
zackman0010
Inserter
Inserter
Posts: 36
Joined: Wed May 18, 2016 8:34 pm
Contact:

[0.14.19] All Number Usernames

Post by zackman0010 »

I was watching a server that I am admin of when I noticed a player with an all numbers username. As it is hosting a PvP scenario, I got curious and attempted to see which force he was on. Trying to index his name, however, caused an error. Example below.

Results of using /p

Code: Select all

Players (18):
  chocolateTthunder
  Baltrius
  Revagor
  Zecheria
  vixoopo1
  dzentak
  BRPW
  kopetam
  chipmike24
  lu4kmo4r
  HeavenlyDeath
  CognizantGhost
  IronCartographer
  rayjiff
  haeruhu
  Nighthawks
  01001010 (<--- All Number Username)
  ViperZ
Results of trying to use all numbers username as index

Code: Select all

/silent-command print(game.players["01001010"].force.name)
Cannot execute command. Error: [string "print(game.players["01001010"].force.name)"]:1: attempt to index field '01001010' (a nil value)
The commands were input into the console, I was not actually in-game.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16048
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.14.19] All Number Usernames

Post by Rseding91 »

I'm not sure if there's a simple solution for this. The "index by name" option is mostly just for convince as the name can be empty if the player is running single player.

The only way you can guarantee to get the player you're after is by using the player index or if you have multiple players iterate and check name for the one you want.
If you want to get ahold of me I'm almost always on Discord.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.14.19] All Number Usernames

Post by kovarex »

I don't think that we should allow usernames with numbers only.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5414
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.14.19] All Number Usernames

Post by Klonan »

kovarex wrote:I don't think that we should allow usernames with numbers only.

That seems like a rather arbitrary rule
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.14.19] All Number Usernames

Post by kovarex »

Klonan wrote:
kovarex wrote:I don't think that we should allow usernames with numbers only.

That seems like a rather arbitrary rule
Why? What kind of username is it if it has only numbers? How many like these do we have?
I mean, this kind of scripting problem would be very unexpected.
posila
Former Staff
Former Staff
Posts: 5448
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.14.19] All Number Usernames

Post by posila »

Thanks for the report. Should be fixed in next release.
posila
Former Staff
Former Staff
Posts: 5448
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.14.19] All Number Usernames

Post by posila »

Actually, it was not fixed ... it seams lua always treats key as string, so our logic "can we convert the key to number? if yes search by index otherwise search by string" is probably the best we can do without hard to explain behavior (like what if somebody make username "1")
User avatar
Jon8RFC
Filter Inserter
Filter Inserter
Posts: 556
Joined: Tue May 10, 2016 3:39 pm
Contact:

Re: [0.14.19] All Number Usernames

Post by Jon8RFC »

Image
Rseding91
Factorio Staff
Factorio Staff
Posts: 16048
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.14.19] All Number Usernames

Post by Rseding91 »

Jon8RFC wrote:Is this resolved?

viewtopic.php?t=57352#p339945
I doubt it. That was a different issue related to JSON.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Jon8RFC
Filter Inserter
Filter Inserter
Posts: 556
Joined: Tue May 10, 2016 3:39 pm
Contact:

Re: [0.14.19] All Number Usernames

Post by Jon8RFC »

I was more so referring to this specific post than the issue regarding json:
posila wrote:
kovarex wrote:That is weird, because we had similar problems when saving numbers in lua state, and as far as I remember, we solved it without using hexes for numbers.
In the end, we did solve it by serializing numbers in lua state in hex format
Still a no-go, with whatever was done for numerals in hex format?
Image
Post Reply

Return to “Resolved Problems and Bugs”