question

lu.zhang@sectionstudios.com avatar image
lu.zhang@sectionstudios.com asked

How to call another cloud script function in the cloud script function?

I want to call another cloud script function in the cloud script. How to do that?

Something like:

handler.function1 = function (args)

{

   function2();

}

handler.function2 = function (args)

{

    log.debug("hello world");

}

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

You would do this by creating a function. So, based on your example, it would be:

 

handler.function1 = function (args)

{

   function2();

}

function function2(args)

{

    log.debug("hello world");

}

 

Have a look at the processPlayerMove function in the basic Cloud Script sample, for an example of this (installed as revision 1 in all new titles, but it's also available in GitHub, here: https://github.com/PlayFab/CloudScriptSamples/blob/master/BasicSample/basic_sample.js).

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lu.zhang@sectionstudios.com avatar image
lu.zhang@sectionstudios.com answered

Nice, thank you!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.