I wondered if it was possible to pass a variable itself to a function rather than the contents of a variable. For instance: If you have a type with lots of different fields, and you want a function to find a certain type instance, but at different times you might want to search using different fields...
...then...
... finds the .stuff whose x=5, and...
... finds the .stuff whose strength=100.
ATM you can do this only by having a different function for searching each different field.
Even better if it could handle different types of variable, so...
... was legal. EVEN BETTER if you could have a type function that could work on any type, so...
EVEN BETTER if you could have optional extra variables in a function, so...
Wouldn't that be super?
Type stuff Field x, y, z, strength End Type Function search.stuff( <var>, value ) For s.stuff = Each stuff If s\<var> = value Then Return s Next Return Null End Function
...then...
thing.stuff = search.stuff( <x>, 5 )
... finds the .stuff whose x=5, and...
thing.stuff = search.stuff( <strength>, 100 )
... finds the .stuff whose strength=100.
ATM you can do this only by having a different function for searching each different field.
Even better if it could handle different types of variable, so...
thing.stuff = search.stuff( <name$>, "Alan" ) thing.stuff = search.stuff( <weapon.weapon>, smg.weapon )
... was legal. EVEN BETTER if you could have a type function that could work on any type, so...
Function search.<type>( <field>, value ) thing.stuff = search.stuff( <name$>, "Alan" ) car.vehicle = search.vehicle( <buildyear>, 1990 )
EVEN BETTER if you could have optional extra variables in a function, so...
Function search.[type]( <field1>, value[, <field2>, value2] [, <field3>, value3] )
Wouldn't that be super?