Consider:
temp.foo = function ()
{
player.chat = "Gads";
};
temp.foo();... would set the player's chat to "Gads".
Because of this you can also send functions as parameters:
temp.bar = function(temp.baz)
{
temp.baz();
};
temp.bar(temp.foo);... would set the player's chat to "Gads".
Helpful hint: Prefix your parameter variables all the time while using nameless functions. The following will not work:
temp.bar = function (baz)
{
baz();
};... because function (baz) is actually translated to function (temp.baz) whereas baz(); is not translated to temp.baz(); (instead it is trying to run a global function called baz() which probably doesn't exist, and if it does, it probably will give the wrong result anyway).