Sign In Register

How can we help you today?

Start a new topic
Answered

Cloudscript custom types

 I don't do a lot of javascript programming so I'm wondering with Cloudscript how do we create and use custom objects?  In C# I will have a bunch of classes, Player, Item, etc. that I then reference in various places.  What is the equivalent in Cloudscript?  If I wanted to create a custom "Item" object and re-use it in a bunch of various cloudscripts how would I do that?


Secondary question, can we import external javascript libraries in Cloudscript?


Thanks.


Best Answer
1. require("MODULE_NAME"); will import the script in MODULE_NAME to the current script.

2. Nope.

 


Answer
1. require("MODULE_NAME"); will import the script in MODULE_NAME to the current script.

2. Nope.

 

Hello.

For the second question: You should put the scripts of the library in a Zip archive, then add the archive to the cloud script using import button.But note that the scripts in the archive must be grouped under a folder that exists on the cloud code (if you want to add the library to real-time modules, for example, you must group them in a folder named rtModules)


2 people like this
Login to post a comment