Page 1 of 1

Factorio lua does not contain io / how to get image size dim

Posted: Sat Nov 21, 2015 4:11 pm
by MrDoomah
Hey all,

As you all know, in a resent update the new technology icons where implemented. This sadly broke my mod: https://forums.factorio.com/forum/vie ... 92&t=17219.

Up to now I just assumed all technology icons where 64x64 in size and this worked with all mods. Now with these icons being 128x128 for the base, and most (all) mods still using the old format this doesn't work. Assuming a 128x128 size will throw errors when mods are used and 64x64 will only show a quarter of the new tech icons.

Since the image dimensions are stored in the header of the image, I decided to try something (for me at least) advanced and read the image dimensions from this header. However, every time I try to use io.open(file) I get an error "attempt to index global 'io' (a nil value)".

To me this means the lua code in factorio doesn't contain the io module? Stating require "io" the same way as stating require "defines" doesn't work.

Or perhaps anyone has another idea to find image dimensions?

Re: Factorio lua does not contain io / how to get image size dim

Posted: Tue Nov 24, 2015 5:04 pm
by Rseding91
There's no way to read image dimensions in a mod right now.

What I'd like to do is create a picture element type where you can set the dimensions and image runtime. I also want to add support for setting background image on stuff like buttons and flows runtime.

These would however be 0.13 things.