Spherical forums

User-Made => Libraries => Topic started by: Metallix on April 08, 2013, 06:25:11 pm

Title: [Script] LinkedList
Post by: Metallix on April 08, 2013, 06:25:11 pm
The following script is a small helper that can be useful when you deal with lists or arrays and change the content often. It implements a super simple linked list.
This is a very simple script and some of you may already have a similar utility script. But it appeared that I use this script already very frequently in my scripts and I want to post some other scripts here soon that requires this script.

It is maybe also good to explain the concept of a linked list to beginners.

Features:


Usage: see script :)

Note: This is tested in TurboSphere. I am not sure if Sphere1.5 supports the null keyword... but if not it is maybe easy to emulate^^

Title: Re: [Script] LinkedList
Post by: alpha123 on April 08, 2013, 07:33:28 pm

Note: This is tested in TurboSphere. I am not sure if Sphere1.5 supports the null keyword... but if not it is maybe easy to emulate^^

JavaScript has had a null keyword since the very first versions. Despite its age, the version of SpiderMonkey in Sphere 1.5 definitely supports it.
Title: Re: [Script] LinkedList
Post by: Metallix on April 09, 2013, 03:47:16 am
Ok, for some reason I thought sphere does not support it. I always avoided to use it in my Sphere code xD
Title: Re: [Script] LinkedList
Post by: Fat Cerberus on April 09, 2013, 03:00:47 pm
The Sphere editor doesn't highlight it for some reason. I was wary of it at first for the same reason, until I researched JS and found out it was a standard part of the language. Then I just felt dumb. :)
Title: Re: [Script] LinkedList
Post by: N E O on April 10, 2013, 12:02:02 pm
Yea, null exists; I've used it all over my PSG and YM2612 scripts with no problem.
Title: Re: [Script] LinkedList
Post by: Metallix on April 12, 2013, 12:23:22 pm
Had some time to checkout what gist is :) -> Updated above ^^