For those of you who don't know what I'm talking about: [URL]http://en.wikipedia.org/wiki/Random_access[/URL]
Any addon that has reason to start reading data from a file at a specific point or to write data to a specific point would greatly benefit from the inclusion of random access functions in the file library. Not to mention it could make the filex.Append function less of a joke.
@Those who think random access is only for binary data:
1) You make me laugh.
2) The only real difference between binary and text data is how you work with it programmatically.
I see no use for this. Could you explain anything specific which could be created or improved by such functions?
This wouldn't help. I mean, think about it. This requires the creator of the addon to specify where in the file the data is. Additionally, that would require quite a lot of work on Garry's part. It's not worth the effort.
[editline]01:14PM[/editline]
[QUOTE=Mr Donovan;23673818]1) You make me laugh.
2) The only real difference between binary and text data is how you work with it programmatically.[/QUOTE]
Lua can't read null bytes, and will stop reading a file as soon as it comes across one. The only benefit of this would be skipping the null byte, allowing you to read the binary data.
[QUOTE=whosdr;23678657]I see no use for this. Could you explain anything specific which could be created or improved by such functions?[/QUOTE]
[LIST=1]
[*]The filex.Append function, as mentioned in the OP. Currently, it's just a helper function that loads the entire file to memory, concatenates the given data, and then overwrites the file.
[*]ULX/etc. logging.
[*]Adv. Duplicator could display the creator/description contained in a dupe file without having to load the entire file.
[*]Pretty much anything with reason to access only part of a relatively large file.
[/LIST]
[QUOTE=|FlapJack|;23681148]This requires the creator of the addon to specify where in the file the data is.[/QUOTE]
What are you trying to say? If you mean when accessing, that's the point of random access.
[QUOTE=|FlapJack|;23681148]Additionally, that would require quite a lot of work on Garry's part. It's not worth the effort.[/QUOTE]
LOL no, no it wouldn't; if Garry can code a game, he can implement random access for files. It's taught in semester-long beginning-level high school programming courses as a basic skill.
Sorry, you need to Log In to post a reply to this thread.