read file
Posted: Thu Aug 29, 2019 6:20 pm
adding support for read file or read json file ?
does Antarctica count, for me it looks like hell.
I called Satan and he said he only goes there on vacations. So: nope.
...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.
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
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
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
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
You can not open non-.lua files even if they are inside the mod directory.Trebor wrote: Fri Aug 30, 2019 4:02 pm Ok, so you want to read an arbitrary file, follow these steps.
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.Trebor wrote: Fri Aug 30, 2019 4:02 pm Ok, so you want to read an arbitrary file, follow these steps.
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.Trebor wrote: Fri Aug 30, 2019 4:02 pm Ok, so you want to read an arbitrary file, follow these steps.
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
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
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