"Stack Overflow at line..." in IE - stack

I'm getting the "Stack overflow at line:" error on IE. I've read a lot of posts here but since I'm not an expert on javascript I don't knot how to apply your solutions to my problem.
The part where I get the error is:
$(window).load(function() {
$('#slider').nivoSlider()
});
It is from a slider I'm using.
Any help is much apprediated.

This suggests something circular is going on: the load() function is invoked, which calls nivoSlider(). What does that function do? Does it somehow result in load() being called again, which calls nivoSlider(), etc.?

Related

My lua code produces the error "Object tried to call nil" when trying to check if a player has a certain trait [PZ]

I'm attempting to mod a game I've been playing recently, and I've encountered an error when writing some code that adds a new mechanic. The problem itself isn't very complicated, but I can't seem to figure out what the solution is in this context. I'm pretty new to coding, especially with lua, so I apologize if the solution is really obvious. I've looked around for some answers, but again, nothing I can find seems to help me in this specific context. The game I'm trying to mod is called Project Zomboid, if that helps.
When attempting to start the game with the mod enabled, the error "Object tried to call nil in isBloodthirsty" pops up. Here's the snippet of code that's causing the error:
local function isBloodthirsty(player)
if player:getDescriptor():getTrait() ~= "bloodthirsty" then
return false else
return true
end
end
Ignoring how poorly written it is, the code was supposed to check if the player had a certain trait, and if so, then set the value isBloodthirsty to true. I think the error is caused by lua not recognizing the value "bloodthirsty", but I'm not sure what I should put instead. If anybody has an idea of what I'm doing wrong, I'd greatly appreciate some help. If it's helpful, I can post the rest of the code.
Thanks to all the great help from the stack overflow community, I managed to figure out what my problem was. The code I had written wasn't working because lua didn't recognize "bloodthirsty" as a valid trait string. My solution was to mix up the code a bit and frame the trait as a profession instead (a profession is kind of like a collection of traits within the game). The following code worked:
local function bloodthirstyStart(player)
if player:getDescriptor():getProfession() ~= "bloodthirsty" then
return
end

In Lua, why might a function or expression evaluate multiple times in an update call?

Working in Lua and I currently I have a function that does:
function Entity:damage(dmg)
self.health = self.health - dmg
end
when I call it in another class's update function, like so:
function Room:update(dt)
if not entity.dead and self.player:collides(entity) then
self.player:damage(1)
end
instead of only dealing 1 damage, it actually deals up to 13 damage, as if the function is being called multiple times, but I'm not sure why that would be? I have very similar functions that are all doing the same thing and I'm not sure why the function/expression therein is being evaluated multiple times?
I've omitted a lot of code because I'm not sure what is relevant to helping. (I am using a Class library and player inherits from entity)
understandably a lot of code is missing and I'll likely end up debugging this myself, but if anyone has a suggestion that might be helpful/steer me in some direction I'd appreciate it, and I do apologize for the poorly formed question.
Thanks to everyone who commented; with your help, I found out what was going on!
First, Piglet you were correct--the 'collision' check state was longer than 1 frame. However, once I fixed that, I still noticed I was getting the wrong return value for
function Room:update(dt)
if not entity.dead and self.player:collides(entity) then
self.player:damage(1)
end
and I think Alexander you were correct in pointing out the multithreading or upvalues--that is a little bit beyond my comprehension at the moment-- but I checked the page linked and discovered that when I moved the function call 'upstream', I was getting the return value I expected.
So it seems perhaps where I was calling the function resulted in it being called or processed multiple times by the update functions of various classes.
Thanks for the comments; I'll use them to improve my question asking and also my general knowledge :)

Trying to fix an auto farming script for a mobile game

I found a 5 month old lua script to automatically farm currency and items in a mobile game called Soda Dungeon, the script was finicky when I found it and wouldn't work properly so I'm trying to fix it with very little lua experience.
Here is the code Ive edited: http://pastebin.com/U9Ymej0z
it runs fine until it tries to start the dungeon and I get this error:
Runtime error: com.appautomatic.ankulua.f:
Can't find dungeon_level_up.png
stack traceback:
[C]: in function 'continueClick'
?: in function <?:291>
(tail call):?
/storage/extSdCard/soda_dungeon/main.lua:
217: in function 'main'
/storage/extSdCard/soda_dungeon/main.lua:
239: in main chunk
Any help is greatly appreciated.
I don't know anything about Ankulua but a quick session with our best buddy google gave me this:
http://ankulua.boards.net/thread/13/advanced-methods
http://ankulua.boards.net/thread/6/objects-methods-introduction-sikuli-compatible
They give those functions:
continueClick(x, y, xRandom, yRandom, times)
continueClick(PSMRL, times [,timeout])
They say continueClick will click on a position given by x,y or PSMRL, which will resolve in a postion as well.
You enter a string that contains an image name.
I assume the message
Can't find dungeon_level_up.png
Is rather an exception text of some find(PS) function inside Ankulua than a problem with finding an image file. Replace that image name with some coordinates and check what is happening.
I would not trust that function call in your script as the author of that script added a comment that he does not know what continueClick returns. So maybe he did not know how to use it as well.
The documentation says:
There is no return value.
Btw, the author of Ankulua offered support via mail. So why don't you ask him? I'm sure he'll be of better help than anyone here.
let me offer you another alternative method, just a few simple click you and drag
It doesn't require root,
background service Installation can be found at the following
hXXp://123autoit.blogspot.tw/2016/08/123autoit-non-root-daemon-service.html
currently only works on ARM
for Android 5.0+
hXXp://play.google.com/store/apps/details?id=com.autoit.nonroot&hl=en
for Android 4.2~4.4
hXXps://play.google.com/store/apps/details?id=com.autoit.nonroot.legacy&hl=en
feel free to send me message to ask for question
here is what it can do
check out the blog, it contains tutorials, and video demo
http://123autoit.blogspot.tw/
Hope everything works out for you,
cheers

Capturing errors in Rust (Rust URL)

Please note I'm using a nightly build of Rust 0.13.0
First off, I'm a beginner to Rust and am still in the process of consuming as much information as possible on the language. Throughout my consumption the one topic I've been able to find very little on is error handling. So, when I first attempted to use an external library in my code I became quickly stumped at how I should be using the material being returned to me.
To help explain my confusion, I will be referencing the rust-url library. Here is some sample code found in the documentation:
use url::{Url, InvalidIpv6Address};
assert!(Url::parse("http://[:::1]") == Err(InvalidIpv6Address))
This is pretty straight-forward to me. However, my next question was: what about the other errors? I looked further into the ParseError enum and found 15+ other types of errors that could be potentially produced by a malformed URL.
So, my question is, what is considered the proper way to handle all of these various conditions? Should I have a lengthy match that alerts out specialized messages for each one? Is there a way to consume them all at once?
I apologize if there is not a single answer to this question, but Google was not making it clear and I would prefer to have feedback on this before I proceed coding the rest of my project the wrong way.
The ParseError enum implements the Show trait, with a custom useful message for each variant, so when you get to the final step of actually handling the parse error (e.g. after manipulating the Result in whatever ways you see fit), you can just treat the error possibilities as a black box:
fn download(s: &str) {
match Url::parse(s) {
Ok(url) => { ... }
Err(e) => {
println!("Could not parse '{}'. {}.", s, e);
}
}
}
will print things like Could not parse 'http://[:::1]'. Invalid IPv6 address..
(I filed #43 about making the Show message lower-cased, so that it flows better in more complicated error messages.)
Url::parse returns ParseResult<Url> which is defined as Result<Url, ParseError>, so you can make use of generic Result methods:
use url::{Url, InvalidIpv6Address};
assert!(Url::parse("http://[:::1]").is_err());
Result is Rust's preferred method for error handling, and has many convenience methods under the hood. For example, if you don't expect the failure you can use .unwrap() to make any failure fatal. When they don't suit your needs, you can also match against the Result.

Usage of _super for _setOption Seems Inconsistent With Documentation?

I believe that I have found a bug in the new _super method of jQuery UI 1.9.x but wanted to run it by you guys first before I reported it. I figure it will be an easy vote for someone out there.
Here's the ticket that I was going to submit. It details the bug:
According to the documentation, _super() takes no arguments. However,
this doesn't work as expected when used in _setOption():
http://jsfiddle.net/grinn/8jKk8/1/
As you can see by clicking the Change Text button, the value of the
text option is not updated even though _super was called properly,
according to the docs at
http://api.jqueryui.com/jQuery.widget/#method-_super
But, if you pass key and value to _super, it does work properly:
http://jsfiddle.net/grinn/8jKk8/2/
I discovered this work-around by viewing the use of _super in the
jQuery UI code, itself.
I'm submitting this as a bug and not a documentation issue because it
would seem _super is expected to work as the documentation states.
Tested in Firefox 17, Chrome 23, and IE 9.
I decided not to report this issue. Judging from the fact that inside jQuery UI they use it as I've described below, I'm thinking that the documentation is just a little vague. For those of you experiencing this same issue, the correct way to use _super appears to be to pass through your arguments, like:
_setOption: function (key, value) {
// Your code goes here...
this._super(key, value);
}
...or more generically:
_setOption: function (key, value) {
// Your code goes here...
this._superApply(arguments);
}

Resources