Search code examples
coldfusioncfwheels

Coldfusion: Set function for object


I have an model object;

building= model("tb_buildings");
building.myFunction() = function(){return false;};

Initially this object has no methods, I am trying to created a method for it called myFunction() and assign it a value of false; I tried the anonymous function approach but it give me an error;

Cannot assign a value to a function

Is this possible?


Solution

  • To set a variable to be a function you should

    building.myFunction = function(){ return false; };