[1.1.0/1.1.1] LuaGuiElement::text doesnt accept numbers

Bugs that are actually features.
Post Reply
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 333
Joined: Tue Jul 08, 2014 10:06 am
Contact:

[1.1.0/1.1.1] LuaGuiElement::text doesnt accept numbers

Post by LuziferSenpai »

Hey,

if you run these two commands:

Code: Select all

/c game.player.gui.screen.add{type = "textfield", name = "test", text = 1}

Code: Select all

/c game.player.gui.screen.test.text = 5
You get the error:
Cannot execute command. Error: (command): 1: bad argument #1 of 2 '__newindex' (string expected, got number)
But whats funny is, that when creating the element it accepts a number.

Greetz,

Luzifer
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.1.0/1.1.1] LuaGuiElement::text doesnt accept numbers

Post by Klonan »

Rseding changed it so you have to be explicit, use tostring() on the number

Post Reply

Return to “Not a bug”