[DEV] Table Serialization 1.3 
6 comments [Developer Tools] Table Serialization
Description
Basically it allows you to output a whole table as a single string; for example, to write it to a file and load later.
Features
Saves any datatype except functions, threads and userdata (it's impossible)
Multidimensional array support
Tabulated human-friendly output
Caution! To serialize such tables as /_G/ you will need to manipulate the function yourself else you will run into an infinite loop! (happened to me, 2GB text file FTW!)
Installation
Basic installation:Extract the archive into CS2D folder.
Execute the lua file with dofile() which will return the function
After that you can access this function under the given name.
How to use
Function: funcName(name, object [, tabs])
name: type the name of the original table (in most cases same as /object/ but it's a string)
object: the table you want to serialize
[Optional] tabs: used internally to pass tabulators as a string (e.g.: "\t\t" will increase the tabulators by 2)
Also check out
MikuAuahDark's work:
table.uneval (6)
Bugs?
Yea, there's one, try to find it
Yet I hope nobody will run into it.
MIT License

Basically it allows you to output a whole table as a single string; for example, to write it to a file and load later.






Basic installation:Extract the archive into CS2D folder.
Execute the lua file with dofile() which will return the function
Code:
1
somevariablenamehere = dofile("/sys/lua/vademon/serialize/serialize.lua")
After that you can access this function under the given name.















edited 9×, last 25.06.14 12:01:52 am

Comments
6 comments



Log in!
You need to log in to be able to write comments!Log in

lol, happened to me once because i tried to print every single varriable of a lua instance and forgot that "_G" contains itself

Awesome script

Well, I did find a bug from looking at the image, though I'm not sure if it's the one you tasked us with finding. See, even though "Welcome, %username%" in randomStrings is assigned the index 18, your serialization assigns it the index 3. That might produce some very nasty errors.



