Dynamicaly creating functions

hi,

how would i go about dynamically making a function… im making a Tile Based World level editor and when the user is done editing a level, then they hit a button and a couple of for loops runs through all the tiles checking the x,y and tile type. then i want this information to be parameters within sub functions within the main function. so the as would look something like this
[AS]subFunction = function () {
//do this
}
//the above function is already defined in the script
generateWorld = function () {
subFunction (x,y,tileType)//a function is called for each tile in world
subFunction (x,y,tileType)
//etc…
}
//the above function (generateWorld) is created dynamically[/AS]

then in the next frame, the generate world function is called.

how would i do this. would i store the information in a multidimensional array? how would i dynamically create a function???

i hope i was clear with what im trying to accomplish,

thanks in advance,

-zylum

i don’t quite get you :(… why exactly does ‘generate world’ need to be declared dynamically?

well it’s going to be different everytime time so… is there a better way to get around this?