Page 1 of 1

Good News!

Posted: Thu Dec 11, 2014 1:51 pm
by Mit
0.68.9 servers now support function array parameters by reference!
Woot!

Posted: Thu Dec 11, 2014 1:53 pm
by morbydvisns
yea what's newbspeak for that?

Posted: Thu Dec 11, 2014 2:00 pm
by Mit
erm, isn't it obvious? :)

Really needs an example (i've got a nice generic school script which ill post later), but essentially..

Say you've got an array like :

Code: Select all

$maSkillsList1[] = 
{
  "Farmer",
  "Lumberjack",
  "Miner",
  "",
}
and you've got a nice lil function that loops the array, building up an OSD or something.
Now you can call the function with the array as a parameter, e.g :

Code: Select all

ShowSchoolsOSD( $maSkillsList1 )
So.. if you want to display a different list (for a different school building for instance), you can just create another array ( $maSkillsList2 for instance ) and call the same display function as in :

Code: Select all

ShowSchoolsOSD( $maSkillsList2 )
Hence I can now go and delete about 60% of my script code, making everything much more maintainable and generic. Well i consider that a woot :]

Posted: Thu Dec 11, 2014 2:08 pm
by morbydvisns
Nice. One of the rare times where 'more generic' is a good thing =).

Posted: Thu Dec 11, 2014 2:15 pm
by Mit
mebbe 'reusable' is a better term.. and that's always a good thing in code land.