Error with object construction on live website

Question:
Hello! I am currently having an issue where my function is behaving differently when it is called through the code blue arrow thing, and when it is called on the website live. The call has the same parameters (Literally copy pasted)

Product:
Velo

What are you trying to achieve:
I am trying to create a object in a backend code function. The object is a class that I have written called gameData in the file gameClassObject. The function creates this game object, modifies it, then returns it.

Additional information:
When calling this function from the editor it functions correctly, with all functionality working as intended. However when I use the function (by pressing a button) on the main website, I get an error β€œ[”_gameClassObject.gameData is not a constructor"]". The reason I am having an issue is that there is a descrepency between how the code behaves in the provided testing environment vs the live environment. I assume this is due to some different in how Velo works between live and test. I am creating the object with the line β€œvar newGame = new gameData()”

Can you share the code that is giving this issue? Quite an odd issue for it to work on the backend but not the frontend. The code itself might help figure it out.

Hello! Sorry about the delayed response, I managed to fix the issue by moving the code to a single file instead of three separate files (A driver file and 2 files that contained a single class). I don’t know why this managed to fix it, but it did.

1 Like