read file

Ideas that are too old (too many things have changed since) and ones which won't be implemented for certain reasons or if there are obviously better suggestions.

Moderator: ickputzdirwech

gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

read file

Post by gabberworld »

adding support for read file or read json file ?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

Will be added shortly after hell freezes over.
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.
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

eradicator wrote: ↑Thu Aug 29, 2019 6:39 pm Will be added shortly after hell freezes over.
does Antarctica count, for me it looks like hell.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

gabberworld wrote: ↑Thu Aug 29, 2019 6:44 pm
eradicator wrote: ↑Thu Aug 29, 2019 6:39 pm Will be added shortly after hell freezes over.
does Antarctica count, for me it looks like hell.
I called Satan and he said he only goes there on vacations. So: nope.
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.
slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: read file

Post by slippycheeze »

eradicator wrote: ↑Thu Aug 29, 2019 6:39 pm Will be added shortly after hell freezes over.
...and at the risk of speaking for the developers, I'm in 100 percent agreement here: they won't add this, just like they won't add any other path for getting external input into the game. The intent seems to be very much the same as other games, where mods live in a very constrained sandbox, and they can't escape it easily.

I was pretty surprised that WriteFile dumps data instantly even in normal running, since most games sandbox that more heavily. There are no easy ways to get input working though.

PS: of course it is possible to escape the sandbox in Factorio, just as in every game, with sufficient creative thought. I wouldn't advise it, but you can probably figure out ways to bypass the restrictions if you try hard enough. After all, someone literally encoded data in small colored squares in one corner of the display to exfiltrate data from WoW, then read it by sampling that part of the screen and decoding it. So ... always possible, but never easy. :)
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

you can't really look this game like other games.

they made at here very good modding stuff, not many game have this kind modding like it's here
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

it's they decision tho if they want give us more power over the game
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

gabberworld wrote: ↑Thu Aug 29, 2019 9:08 pm it's they decision tho if they want give us more power over the game
Mainly they want to prevent crashes/desyncs. And reading random files from the system is *impossible* to make desync free, so it's not going to happen. You can read lua files from your mod directory because that's (within reason) guaranteed to be equal on all computers with the same mod version. If you want to read json, then encode your json as a string in a lua file and read that. If you want to read the whole harddisk of anybodys computer... then overthink your life decisions.
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.
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

eradicator wrote: ↑Fri Aug 30, 2019 7:45 am
gabberworld wrote: ↑Thu Aug 29, 2019 9:08 pm it's they decision tho if they want give us more power over the game
Mainly they want to prevent crashes/desyncs. And reading random files from the system is *impossible* to make desync free, so it's not going to happen. You can read lua files from your mod directory because that's (within reason) guaranteed to be equal on all computers with the same mod version. If you want to read json, then encode your json as a string in a lua file and read that. If you want to read the whole harddisk of anybodys computer... then overthink your life decisions.
i think'ed more like same way like write_file works, but read whole harddisk of anybodys computer sounds great too
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

gabberworld wrote: ↑Fri Aug 30, 2019 8:42 am i think'ed more like same way like write_file works, but read whole harddisk of anybodys computer sounds great too
Maybe you should go to hell and personally file the request directly to Satan.
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.
slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: read file

Post by slippycheeze »

eradicator wrote: ↑Fri Aug 30, 2019 7:45 am
gabberworld wrote: ↑Thu Aug 29, 2019 9:08 pm it's they decision tho if they want give us more power over the game
Mainly they want to prevent crashes/desyncs. And reading random files from the system is *impossible* to make desync free, so it's not going to happen. You can read lua files from your mod directory because that's (within reason) guaranteed to be equal on all computers with the same mod version. If you want to read json, then encode your json as a string in a lua file and read that. If you want to read the whole harddisk of anybodys computer... then overthink your life decisions.
I should channel a Haskell fan and mention the IO monad... ;)
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: read file

Post by Trebor »

Ok, so you want to read an arbitrary file, follow these steps.
  • Install the Linux or Mac version of Factorio.
  • Create and install an unzipped mod, so directories are real directories.
  • Create in your mod directory a hard link to the file you want to read.
If Factorio follows soft links, create a soft link to /.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

Trebor wrote: ↑Fri Aug 30, 2019 4:02 pm Ok, so you want to read an arbitrary file, follow these steps.
You can not open non-.lua files even if they are inside the mod directory.
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.
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: read file

Post by Trebor »

eradicator wrote: ↑Fri Aug 30, 2019 5:14 pm
Trebor wrote: ↑Fri Aug 30, 2019 4:02 pm Ok, so you want to read an arbitrary file, follow these steps.
You can not open non-.lua files even if they are inside the mod directory.
Just be creative with the hard link name.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

Trebor wrote: ↑Fri Aug 30, 2019 5:16 pm
eradicator wrote: ↑Fri Aug 30, 2019 5:14 pm
Trebor wrote: ↑Fri Aug 30, 2019 4:02 pm Ok, so you want to read an arbitrary file, follow these steps.
You can not open non-.lua files even if they are inside the mod directory.
Just be creative with the hard link name.
To what end? require() will simply throw an error if the file is trash.
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.
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

i think'ed use the require(), but that is a very ugly way todo
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

gabberworld wrote: ↑Fri Aug 30, 2019 5:28 pm i think'ed use the require(), but that is a very ugly way todo
Back from hell so soon eh, i guess Satan didn't approve your request?

As this is already your second thread about "loading random files/mysql", maybe you should instead ask for help in the modding help forum and describe what you actually want to do. Factorio does infact have built-in support for converting json strings to lua tables for example.
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.
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

eradicator wrote: ↑Fri Aug 30, 2019 5:38 pm
gabberworld wrote: ↑Fri Aug 30, 2019 5:28 pm i think'ed use the require(), but that is a very ugly way todo
As this is already your second thread about "loading random files/mysql"
not sure what you talk at here, package.loadlib is totally different thing , it allows run custom maded lua dll's, if you mean that
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read file

Post by eradicator »

gabberworld wrote: ↑Fri Aug 30, 2019 5:43 pm
eradicator wrote: ↑Fri Aug 30, 2019 5:38 pm
gabberworld wrote: ↑Fri Aug 30, 2019 5:28 pm i think'ed use the require(), but that is a very ugly way todo
As this is already your second thread about "loading random files/mysql"
not sure what you talk at here, package.loadlib is totally different thing , it allows run custom maded lua dll's, if you mean that
It's totally the same thing in that it's "wanting to load some random file that is not lua code".
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.
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: read file

Post by gabberworld »

only thing is lua stuff can be also build to inside dll soo technically its still lua code,

but that is nothing todo with read file request
Post Reply

Return to β€œOutdated/Not implemented”