Module for arrays

BlitzMax Forums/BlitzMax Module Tweaks/Module for arrays

KamaShin(Posted 2005) [#1]
Hi,
I've made a very small modulethat brings a few functions for dealing with arrays (you'll find Append, Insert, Remove, IndexOf)... I ve tested the module a bit but I'd like feedbacks about bugs (and comments of course)

http://kamashin2.free.fr/kamashin.tar

and if you can't handle tar, try using this rar version instead:
http://membres.lycos.fr/kamashinsoft/kamashin.rar

also please read the commands.html as it explains how you should call the functions (it's kinda weird for now due to a bug in BlitzMax... Mark is aware of it and I'll change the methods for simpler ones as soon as the problem is solved)

for anyone who would like to add (like myself) the commands to the commands.txt file to have syntax highlighting in the editor, here is what you should add, sorted alphabetically:

Append:Object[]( t:Object[],o:Object )|/mod/kamashin.mod/arraysutil.mod/doc/commands.html

IndexOf:Int( t:Object[] Var, o:Object )|/mod/kamashin.mod/arraysutil.mod/doc/commands.html

Insert:Object[]( t:Object[] Var,ind:Int,o:Object )|/mod/kamashin.mod/arraysutil.mod/doc/commands.html

RemoveInd:Object[]( t:Object[], ind:Int )|/mod/kamashin.mod/arraysutil.mod/doc/commands.html

RemoveObj:Object[]( t:Object[] Var, o:Object )|/mod/kamashin.mod/arraysutil.mod/doc/commands.html


KamaShin(Posted 2005) [#2]
I forgot to say: for anyone who doesn't know how to install a module:
in the uncompressed folder, you should find a kamashin.mod folder. Put it in your BlitzMax/mod folder, next to pub.mod and brl.mod (not insinde pub or brl... NEXT to them), that's all... as for the TestArray.bmx, this is a small and dirty piece of code I wrote to test the functions.


KamaShin(Posted 2005) [#3]
ok... since some people told me about tar problem on windows, here is a rar version which (I hope) should work... (lycos sometimes prevent people from downloading I don t know why, and free.fr corrupts on purpose .rar and .zip), so anyway, here is the link:

http://membres.lycos.fr/kamashinsoft/kamashin.rar


Beaker(Posted 2005) [#4]
Added this to Insert/Concat arrays together:
Function InsertArray:Object[](t:Object[],o:Object[],ind:Int=9999999)
	Local i:Int, size:Int, size2:Int
	
	i = 0
	size = Len(t)
	size2 = Len(o)
	t = t[..size+size2]
	If ind>=size Then
		For i=0 To size2-1
			t[size+i] = o[i]
		Next
		Return t
	End If
	For i=size-1 To ind Step -1
		t[i+size2] = t[i]
	Next
	For i=0 To size2-1
		t[ind+i] = o[i]
	Next
	Return t
End Function



KamaShin(Posted 2005) [#5]
Great, I didn't think about concat... Thanks a lot, adding it right now :)


KamaShin(Posted 2005) [#6]
Ok, module has been updated: added Beaker's idea to concat arrays:
in the commands.txt, if you want to have syntax highlighting, add this:

Concat:Object[]( t:Object[],o:Object[],ind:Int=-1 )|/mod/kamashin.mod/arraysutil.mod/doc/commands.html

http://membres.lycos.fr/kamashinsoft/ and then click on the file kamashin.rar
(don't use the direct link to kamashin.rar cause Lycos seems to refuse direct connections with files... it wants you to have a look at the site)


Beaker(Posted 2005) [#7]
Did I mention how annoying that damn animated gif is to my forum viewing experience? :D


KamaShin(Posted 2005) [#8]
LOL :) I like it :))) (but I may not be very objectiv then ^_^)