Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Can "Tables" run out of data?

Asked by 9 years ago

I'm just wondering if it can physically run out of data?

Are tables like this below able to run out of data or its how much data you can cram into it in 1 script.

FakeTable={}

table.insert(FakeTable,FakeData)

1 answer

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

Yes, they can -- but only when the program isn't allowed to get more memory (from the system).

I'm not precisely sure what the limit is on ROBLOX, or what happens when you hit it, but it will be difficult to reach that limit: as you add more things to tables, it also gets slower to do anything to them.


For reasonable programs, you won't hit this limit. You can store an incredibly excessive amount of information and still not hit this limit.

Storing one hundred thousand words, ten times, for instance, is well, well within modern memory capabilities.


Here's a script that exhausts Lua's memory:

local x = "a";

local t = {};
while true do
        table.insert(t,x);
        x = x:lower() .. x:upper();
    wait();
    print(#t * #x / 2);
end

After reaching 3758096384 (an estimate of the amount of memory it is using), it errors and reports

22:12:16.648 - not enough memory 22:12:16.650 - Stack Begin 22:12:16.650 - Script 'Workspace.Script', Line 6 22:12:16.650 - Stack End

0
:O WOAH MessorAdmin 598 — 9y
0
Just out of curiosity, what does putting a semi colon after each line do? Discern 1007 — 9y
0
https://scriptinghelpers.org/questions/6044/what-is-used-for TLDR: Marks the ends of statements (which usually is optional). Other programming languages require it, so it can be habit for some programmers to use it. BlueTaslem 18071 — 9y
0
Gotcha. Thanks. Discern 1007 — 9y
Ad

Answer this question