Re: Questions, questions...
Posted: 08 Oct 2013 14:40
.
The Official Genesis MUD Forums
https://www.genesismud.org/forums/
In what scenario?Yanus wrote:Why args.length is undefined?
args is an object, objects in JS have no length property and that's what's causing it to be undefined. You can iterate through them but you can't invoke array-specific functions on them (like length).Yanus wrote:Alias.
Name: bromba
Type: javascript
Body:Input:Code: Select all
gwc.output.append(args.length); gwc.output.append(args[1]);
Output:Code: Select all
bromba alalala
Code: Select all
undefined alalala
Your example isn't 100% clear to me, but hopefully some of this helps? If you are actually passing in an argument like args, then its possible in your example that args could be an object, not an array.Yanus wrote: @Zhar
That's the ancient problem.
Code: Select all
var obj = {};
obj[1] = 'test';
Code: Select all
gwc.output.append(arguments.length);
Yes. in Zmud I have the 0 on the numpad as h all and I hit it compulsively all the time.Yanus wrote:@Arcon:
What do you mean by that? Is macro being fired up on pressing the key (without the need to press Enter afterwards)?
I don't think it's possible at the moment.
@Zhar
That's the ancient problem.