[DMC] Posted October 13, 2010 Share Posted October 13, 2010 hey, i got a script for the admins when i do /admins it says Level 10= level 9= etc but when i do this its saying stack overflow im not comfortable with posting this so im just asking what this error means Link to comment
Callum Posted October 14, 2010 Share Posted October 14, 2010 That the stack has overflown. I've only ever reproduced this by calling a function from within itself, like; function a() a() end Link to comment
Castillo Posted October 14, 2010 Share Posted October 14, 2010 callum, i have seen his code if i'm right he is doing that Link to comment
Wojak Posted October 14, 2010 Share Posted October 14, 2010 hey,i got a script for the admins when i do /admins it says Level 10= level 9= etc but when i do this its saying stack overflow im not comfortable with posting this so im just asking what this error means there are at lest two ways to prevent this: 1) Proper Tail Call function a() return a() end Because a proper tail call uses no stack space, there is no limit on the number of "nested" tail calls that a program can make. For instance, we can call the following function with any number as argument; it will never overflow the stack. 2) setTimer function function a() setTimer (a,50,1) end i always use "setTimer" method myself, ofcourse the interval may be difrent than 50 (50 is minimum) Link to comment
[DMC] Posted October 14, 2010 Author Share Posted October 14, 2010 gues im wasting your guys time cuz idk what you guys mean Link to comment
dzek (varez) Posted October 14, 2010 Share Posted October 14, 2010 infinite loop/infinite recursion causes this. Wojak: -- this is infinite recursion too !! and will trigger stack overflow function a() return a() end Link to comment
Wojak Posted October 14, 2010 Share Posted October 14, 2010 i was bored in the work one day and i read the lua manual... this expresion function a() return a() end is a "Proper Tail Cal" and lua interpreter treats it like "GoTo" and do not use any stack space. No stack -> no stack overflow http://www.lua.org/pil/6.3.html of course every scripter should know how to prevent Infinite loops using conditions and i think this exemple may result in FPS drop. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now