Saad A
Saad A

Reputation: 1147

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?

Upvotes: 1

Views: 188

Answers (1)

James A Mohler
James A Mohler

Reputation: 11120

To set a variable to be a function you should

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

Upvotes: 8

Related Questions