read file
Moderator: ickputzdirwech
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
read file
adding support for read file or read json file ?
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
does Antarctica count, for me it looks like hell.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Filter Inserter
- Posts: 587
- Joined: Sun Jun 09, 2019 10:40 pm
- Contact:
Re: read file
...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.
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
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
they made at here very good modding stuff, not many game have this kind modding like it's here
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
it's they decision tho if they want give us more power over the game
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
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.gabberworld wrote: βThu Aug 29, 2019 9:08 pm it's they decision tho if they want give us more power over the game
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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
i think'ed more like same way like write_file works, but read whole harddisk of anybodys computer sounds great tooeradicator wrote: βFri Aug 30, 2019 7:45 amMainly 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.gabberworld wrote: βThu Aug 29, 2019 9:08 pm it's they decision tho if they want give us more power over the game
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
Maybe you should go to hell and personally file the request directly to Satan.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
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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Filter Inserter
- Posts: 587
- Joined: Sun Jun 09, 2019 10:40 pm
- Contact:
Re: read file
I should channel a Haskell fan and mention the IO monad...eradicator wrote: βFri Aug 30, 2019 7:45 amMainly 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.gabberworld wrote: βThu Aug 29, 2019 9:08 pm it's they decision tho if they want give us more power over the game
Re: read file
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.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: read file
Just be creative with the hard link name.eradicator wrote: βFri Aug 30, 2019 5:14 pmYou can not open non-.lua files even if they are inside the mod directory.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
To what end? require() will simply throw an error if the file is trash.Trebor wrote: βFri Aug 30, 2019 5:16 pmJust be creative with the hard link name.eradicator wrote: βFri Aug 30, 2019 5:14 pmYou 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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
i think'ed use the require(), but that is a very ugly way todo
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
Back from hell so soon eh, i guess Satan didn't approve your request?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", 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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
not sure what you talk at here, package.loadlib is totally different thing , it allows run custom maded lua dll's, if you mean thateradicator wrote: βFri Aug 30, 2019 5:38 pmAs this is already your second thread about "loading random files/mysql"gabberworld wrote: βFri Aug 30, 2019 5:28 pm i think'ed use the require(), but that is a very ugly way todo
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: read file
It's totally the same thing in that it's "wanting to load some random file that is not lua code".gabberworld wrote: βFri Aug 30, 2019 5:43 pmnot sure what you talk at here, package.loadlib is totally different thing , it allows run custom maded lua dll's, if you mean thateradicator wrote: βFri Aug 30, 2019 5:38 pmAs this is already your second thread about "loading random files/mysql"gabberworld wrote: βFri Aug 30, 2019 5:28 pm i think'ed use the require(), but that is a very ugly way todo
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.
Mod support languages: ζ₯ζ¬θͺ, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 70
- Joined: Sat Aug 17, 2019 11:06 pm
- Contact:
Re: read file
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
but that is nothing todo with read file request