Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some functions to the File class #296

Open
Pirulax opened this issue Aug 3, 2018 · 5 comments
Open

Add some functions to the File class #296

Pirulax opened this issue Aug 3, 2018 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@Pirulax
Copy link
Contributor

Pirulax commented Aug 3, 2018

Is your feature request related to a problem? Please describe.
Partially, because sometimes I just want to rewrite the whole file, so a functions like:
File.readall
File.writeall
And maybe: File.clear

Describe the solution you'd like
Add the mentioned functions.

@Pirulax
Copy link
Contributor Author

Pirulax commented Aug 3, 2018

This can be implemented in lua, but it's way faster to do it in c++, because of the time it takes to call an MTA function(3k-12k ms / 10m calls, seems like functions which use argStream.nextIs*() are slower, especially Vector3.create which takes 12k ms / 10m).

@qaisjp
Copy link
Contributor

qaisjp commented Aug 3, 2018

How frequently are you writing to files, and how large are your files (what are you writing?), that the latency is becoming a problem?

@Pirulax
Copy link
Contributor Author

Pirulax commented Aug 3, 2018

I'll write a lot because the way I save the data of my custom interiors.
It's not a problem for now(since the server hasn't opened yet), but it may became a problem after a while.
I'd make the mentioned functions, but I'm lost a little bit with the File class(can't even figure out how it gets it's size 😂)

@ghost
Copy link

ghost commented Aug 4, 2018

can you please tell me more about File.writeall? How many parameters will this function take? I'm thinking that we can pass a Lua table to the function, and it writes all the data quickly to the file.

@Pirulax
Copy link
Contributor Author

Pirulax commented Aug 4, 2018

Actually, it should be called 'writeAll'
Nah, I thought it should take the same as write, but before writing it should clean the file up, so only the strings passed to it'll be written, or better:
Just merge it with the current 'write' function and add a 'bClear' argument.

@patrikjuvonen patrikjuvonen added the enhancement New feature or request label Aug 5, 2018
@botder botder added this to the Backlog milestone Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants