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)
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)
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
:O WOAH
Just out of curiosity, what does putting a semi colon after each line do?
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.
Gotcha. Thanks.