I have tested it in remix and the function does work, I also removed inputs just for testing purposes but it seems that it doesn't work anyway.
Here is the function:
struct Message{
string Message;
int Vote;
uint timeSubmit;
bool isImportant;
uint senderId;
}
Message[] messageArr;
function getMessageString() public view returns(string memory){
return messageArr[2].Message;
}
I am calling it in web3.js like this:
function getString() {
messageInstance.getMessageString(function(error, result){
if (error) {
console.log(error)
}
else {
console.log("yes")
}})
}
I am using truffle but it keeps giving me this error.