[Plugin] Can "set_any" pass an object?

Discussion and feedback on Construct 2

Post » Thu Oct 20, 2011 3:44 am

This question is about creating plugin.

In expression.js:
[code]     expvalueProto.set_any = function (val)
     {
          if (typeof val === "number")
          {
              this.type = cr.exptype.Float;
              this.data = val;
          }
          else if (typeof val === "string")
          {
              this.type = cr.exptype.String;
              this.data = val.toString();
          }
          // null/undefined/an object for some reason
          else
          {
              this.type = cr.exptype.Integer;
              this.data = 0;
          }
     };[/code]

It seems an object will be ignored by
[code]this.type = cr.exptype.Integer;
this.data = 0;[/code]

Can "set_any" pass an object type? Maybe it can carry an object like an array to another plugin object.rexrainbow2011-10-20 03:49:23
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Thu Oct 20, 2011 2:24 pm

No - the only expression types supported are int, float and string. Arrays might be supported in future but not for the time being.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Oct 20, 2011 3:18 pm

Glad to hear that.
Maybe I can use string to replace passing an array object.

Btw, another question is
How to get combo list of instance variables name?rexrainbow2011-10-20 16:53:02
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests