Files

> > CS2D > Lua Scripts > [DEV] Table Serialization 1.3
Files overviewCS2D overviewLua Scripts overview

English [DEV] Table Serialization 1.3 >

6 comments2 kb, 469 Downloads

old [DEV] Table Serialization 1.3

VADemon
User Off Offline

[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
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

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


∗ MIT License ∗
edited 9×, last 25.06.14 12:01:52 am
Approved by Sparty

Download Download

2 kb, 469 Downloads

Comments

6 comments
To the start Previous 1 Next To the start

Log in!

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

old

pro CS2D
BANNED Off Offline

i cant Like this shitt

old

Necr0
User Off Offline

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
I like it!

old

Infinite Rain
Reviewer Off Offline

I prefer using my own version, much simplier and no useless functions.

Script >

old

EngiN33R
Moderator Off Offline

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.

old

MikuAuahDark
User Off Offline

Okay it's simply faster than mine.
1
2
executionTime(table.uneval,entitylist())
executionTime(table.serialize,"a",entitylist())
And it output:
1
2
0.514		-- table.uneval
0.510		-- table.serialize
That's why i give you a like.
I like it!

old

I_am_an_idiot
BANNED Off Offline

Like you are nmooobcvobjopfj'gmsd!!
I like it!
To the start Previous 1 Next To the start