DiSaMe Posted January 30, 2009 Share Posted January 30, 2009 Is there any way of writing fixed number of bytes from any data type? For example, if a string is shorter than specified number of bytes, it would be lengthened with bytes that have value 0 (byte number, not a character "0"). And no need to convert number to string? I don't want to convert 4-byte value to the longer non-fixed length string by making it harder to read... Link to comment
arc_ Posted January 30, 2009 Share Posted January 30, 2009 Check out the string.char and string.rep functions in the Lua manual. I have to say though that messing around like this to store an integer seems rather hacky. Unless for some reason you have no choice but to use binary files, I would recommend using an .xml file or an SQLite or other database. Link to comment
DiSaMe Posted January 30, 2009 Author Share Posted January 30, 2009 OK, thanks. I had made XML accounts system in my gamemode, but I decided to get rid of it. Fortunately, I can use format with separating symbol Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now