Nikilis
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 949 |
|
|
| 30 Jul 2013 10:43 PM |
| What are the ways to cause them? |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 30 Jul 2013 10:46 PM |
Part['Changed']:connect( function() Part['Transparency'] = math['random']() end) |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
Nikilis
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 949 |
|
|
| 30 Jul 2013 11:13 PM |
| Anything else? I know calling a function within it's own function. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 31 Jul 2013 01:17 AM |
function Egg() return Chicken() end
function Chicken() return Egg() end
Which came first? QQ |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 31 Jul 2013 01:25 AM |
@cnt
depends on which you call first. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 31 Jul 2013 01:28 AM |
| dey still will error either way c: |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 31 Jul 2013 03:56 AM |
The egg came first. Over millions of years of constant evolution eventually another species of similar aesthetic would lay an egg containing the very first Chicken.
#HowToConfusePeopleWhoAskThisQuestionWithLittleBrainPower |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2013 04:22 AM |
The stack is a list of addresses pointing to variables. Every time a function is called, the program enters a new scope, information about the function call is added to the stack, and the local variables in the scope are added as well. Once the function returns, the memory it was using is freed. However, if you call a function with infinite recursion, none of the function calls will ever return because they're waiting for a function to return which is also waiting for its function to return. The stack is filled with function calls, and overflows.
Note that the inclusion of a wait() would not prevent stack overflow.
function a() wait() a() end
a()
It would simply take longer.
Also note that calling the function twice would not decrease the time to stack overflow, because the function would never reach the second call.
function a() a() a() --The program will never reach the above call because the first call sends the program to a new scope repeatedly. print("Hello?") end
a()
One thing you could do to cause stack overflow sooner is give a function with infinite recursion a large list of parameters and also a large number of local variables.
The Unwise Wizard of Scripters has spoken. |
|
|
| Report Abuse |
|
|
Nikilis
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 949 |
|
|
| 31 Jul 2013 10:11 AM |
| I'm trying to stop stack overflows but thanks for the info x) |
|
|
| Report Abuse |
|
|
DrVulcan
|
  |
| Joined: 15 Jul 2013 |
| Total Posts: 320 |
|
|
| 31 Jul 2013 10:12 AM |
| function a(b) print(b) a(b) end |
|
|
| Report Abuse |
|
|
Nikilis
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 949 |
|
|
| 31 Jul 2013 11:06 AM |
| I already said I knew about that one. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2013 12:10 PM |
| Unrelated comment: At first I thought the title meant users of the Stack Overflow coding help site. |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 31 Jul 2013 02:43 PM |
@Nikilis I was talking about a different kind of stack overflow, which might not have been a stack overflow but some other kind of buffer overflow or memory error. It would occur because events are not handled in Lua, but by the actual program. A stack overflow in Lua would only make the script error, not disconnect everyone. |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 31 Jul 2013 02:53 PM |
script.Changed:connect(function () script.Name = tostring(tonumber(script.Name)) == script.Name and script.Name+1 or 0 end)
I wonder if this would do the trick. (It's probably incorrect syntax but you get the idea) |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
| |
|
|
| 31 Jul 2013 03:24 PM |
Censored version:
local stack = [maximum value of 32 bit signed integer number] stack = stack + 1 |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 31 Jul 2013 04:09 PM |
local stack = Two billion one hundred forty-seven million four hundred eighty-three thousand six hundred forty-seven stack = stack+1
:D |
|
|
| Report Abuse |
|
|
Nikilis
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 949 |
|
|
| 31 Jul 2013 04:53 PM |
| The problem was: Disabled a VehicleSeat when someone was already on it. Or at least it seems to be, for now. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 31 Jul 2013 04:54 PM |
| I got filtered like 4 times for talking about a mature topic that the filter didn't like. It's freaking madness. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 31 Jul 2013 05:04 PM |
"Part['Changed']:connect( function() Part['Transparency'] = math['random']() end)"
Interestingly, this is the worst example here, because it may not actually stack overflow. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 31 Jul 2013 09:04 PM |
"Interestingly, this is the worst example here"
Thank you. I try. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
brinker7
|
  |
| Joined: 22 Jun 2009 |
| Total Posts: 129 |
|
|
| 01 Aug 2013 07:43 AM |
Thing={} setmetatable(Thing,{__newindex=(function() Thing.Another=Thing end)}) Thing.Stuff="Orly?"
Free overflows for everyone |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 01 Aug 2013 11:11 AM |
Special kind of stack overflow that crashes the game and disables the creation of a new server for about 5 minutes:
local function Overflow(object) object.DescendantAdded:connect(Overflow) Instance.new("IntValue", object) end Overflow(Game) |
|
|
| Report Abuse |
|
|