generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: TableValue?

Previous Thread :: Next Thread 
sk8ercool456 is not online. sk8ercool456
Joined: 24 Jan 2008
Total Posts: 1846
21 Nov 2011 06:22 PM
We need some kind of TableValue. To reduce lag, I took a script of mine that does hundreds of calculations in a very short period of time. I made it do all of the calculations, and then wrote it to a table. I need some way to save this table to the place. I can't type all of them out, because there's way too many values.

Anyway, we should have a TableValue object that you can write tables to.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
21 Nov 2011 06:34 PM
S&I?
Report Abuse
LocalChum is not online. LocalChum
Joined: 04 Mar 2011
Total Posts: 6906
21 Nov 2011 06:35 PM
Check out the RbxUtility.EncodeJSON (not sure of exact name) function?
Report Abuse
Varp is not online. Varp
Joined: 18 Nov 2009
Total Posts: 5333
21 Nov 2011 06:40 PM
Tables are difficult to store, and even more difficult to replicate across the server. I mean, if you have primitive indexes and values (numbers, strings, booleans) it's relatively easy, but when you start nesting tables or having weird indexes (like functions, other tables, coroutines, etc.) it becomes very difficult, if not impossible to serialize. Worse, if you have the code:

local x = 0
local t = {}
function t:embiggen()
x = x + 1
return x
end

You have to serialize the function somehow! Unfortunately, this function's closure contains a reference to the local value x. In fact, the function's closure contains every value in the script _by reference_. It is not possible to share that function between scripts without rewriting Lua, thus general tables cannot be shared.

You can write specific code which makes a series of Value objects that represents the table you output. Roblox cannot provide a general implementation for you. However, before you try to do something like this, you should try to find an alternative, since this is an expensive, and for the most part, needless operation.
Report Abuse
bombpaw is not online. bombpaw
Joined: 15 Mar 2009
Total Posts: 3484
21 Nov 2011 06:41 PM
._. Local, how long has that been out?
Report Abuse
LocalChum is not online. LocalChum
Joined: 04 Mar 2011
Total Posts: 6906
21 Nov 2011 06:45 PM
About since plugins were released.
Report Abuse
sk8ercool456 is not online. sk8ercool456
Joined: 24 Jan 2008
Total Posts: 1846
21 Nov 2011 06:49 PM
I don't see anything about it in the wiki or object browser.

more info/link pl0x?
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
21 Nov 2011 08:01 PM
:O

And there's the MakeWedge function there too...

Why don't they use it in the terrain generator and all of these, instead of just putting it separately? They could just load the library. T_T

Woah, I gotta love these libraries.. well, nah, because we can't register our own libraries yet.

Yet, I have some libraries that I want to transfer to this system. I'm tired of using _G to store my libraries..
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
21 Nov 2011 08:06 PM
"I don't see anything about it in the wiki or object browser.

more info/link pl0x?"

local RbxUtility = LoadLibrary "RbxUtility" -- Loads the library and stores it in the variable 'RbxUtility'.

-- Print the current content of the library.
for _, name in pairs(RbxUtility:GetApi()) do
print(name)
end

Current Output:
MakeWedge
Help
EncodeJSON
DecodeJSON

To get help on a function, use RbxUtility.Help(functionName).

Example:

local RbxUtility = LoadLibrary "RbxUtility"

print(RbxUtility.Help("MakeWedge"))

Output:
Function MakeWedge. Arguments: (x, y, z, [default material]). Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was. Returns true if made a wedge, false if the cell remains a block
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
21 Nov 2011 08:10 PM
>print(ut:MakeWedge())

20:09:50 - 'TerrainService' is not a valid Service name

ಠ_ಠ
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
21 Nov 2011 08:13 PM
*looking at RbxUtility's source*

"Copyright 2007 Shaun Brown"

roblox

y u so incapable of making your own stuff
Report Abuse
Aaaboy97 is not online. Aaaboy97
Joined: 05 Apr 2009
Total Posts: 6612
21 Nov 2011 08:17 PM
print(LoadLibrary('RbxUtility').EncodeJSON({[999]='hai'}))
> [null null null null...
Report Abuse
ENET is not online. ENET
Joined: 01 Jan 2010
Total Posts: 4820
21 Nov 2011 09:31 PM
Lua needs to be able to store and index the addresses of certain objects. Then you could have pointers to a table.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
21 Nov 2011 11:17 PM
Serialize it to a string of Lua data, which you can loadstring later. (why would you use JSON when you get free loading with loadstring, from a format which is almost identical to JSON?)

Eg:
Save:
someStringValue.Value = "return {"..doSerialize(myData).."}"

Load:
myData = loadstring(someStringValue.Value)()
Report Abuse
sk8ercool456 is not online. sk8ercool456
Joined: 24 Jan 2008
Total Posts: 1846
23 Nov 2011 08:06 PM
Ah, great idea stravant:

t = Workspace.SomeStringValue
example = {1, 2, 3}

t.Text = "example = {"
for _, v in pairs(example) do
t.Value = t.Value..v..", "
end
t.Value = t.Value:sub(1, #t.Value - 2).."}"
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
23 Nov 2011 08:20 PM
I thought that when Lua dumped a table it dumped the table's memory. :/

I personally wouldn't want ROBLOX sending raw table memory over an insecure connection.
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
23 Nov 2011 11:41 PM
@popin

The whole game to played over an insecure connection. Why would the table contents matter anyway?
Report Abuse
sk8ercool456 is not online. sk8ercool456
Joined: 24 Jan 2008
Total Posts: 1846
23 Nov 2011 11:45 PM
They don't even encrypt the BC purchase page for crying out loud :P
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
24 Nov 2011 07:44 AM
lol i send my tables to client and server by doing a tree of

MODEL (=Pair of key and value)
*Key (some ____Value object)
*Data (some ____Value object, or contains more of these pairs if the value is table)

Efficient, eh?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image