I'm quite new at programming and I'm facing an issue where i'm not able to acces a public variable from a contract.
In the contract, I've declared following public variable:
uint public numFoodInfos;
In JS I try to call this variable:
contractAdressF2F = "...";
ABIArrayF2F = ...;
dataF2F = "...";
myContractF2F = web3.eth.contract(ABIArrayF2F).at(contractAdressF2F);
myContractF2F.numFoodInfos.call(function (error, result) {
if (!error)
console.log(result.toNumber())
else
console.log(error);
});
However, this returns 'null'.
Anyone sees the problem here? I read that public variables should generate a getter function automatically.
FYI, I'm using the meteor framework. Other custom functions of the same contract do work...