English [DEV] Table Serialization 1.3 icon

6 comments
31.08.13 04:43:07 am
like 3 like it!
2 kb, 91 Downloads
VADemon
User
Offline Off
[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

illegal 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
Code:
1
somevariablenamehere = dofile("/sys/lua/vademon/serialize/serialize.lua")

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)

Examples >


Changelog >


° Also check out user MikuAuahDark's work: file cs2d table.uneval (6)

∗ Bugs?
> Yea, there's one, try to find it Yet I hope nobody will run into it.


∗ MIT License ∗
image
edited 9×, last 25.06.14 12:01:52 am
ok This file has been reviewed and approved by Sparty (04.12.15 10:26:32 am)

Comments

6 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
31.12.13 08:00:54 pm
Up
pro CS2D
BANNED
Offline Off
i cant Like this shitt
06.09.13 04:17:21 pm
like I like it!
Up
Necr0
User
Offline Off
More >

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
06.09.13 03:21:12 pm
Up
Infinite Rain
Reviewer
Offline Off
I prefer using my own version, much simplier and no useless functions.

Script >
31.08.13 11:19:31 am
Up
EngiN33R
Moderator
Offline Off
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.
31.08.13 08:26:21 am
like I like it!
Up
MikuAuahDark
User
Offline Off
Okay it's simply faster than mine.
Code:
1
2
executionTime(table.uneval,entitylist())
executionTime(table.serialize,"a",entitylist())

And it output:
Code:
1
2
0.514          -- table.uneval
0.510          -- table.serialize

That's why i give you a like.
31.08.13 07:55:40 am
like I like it!
Up
I_am_an_idiot
BANNED
Offline Off
Like you are nmooobcvobjopfj'gmsd!!
To the start Previous 1 Next To the start