How do I get a member' value from scripting
by Ken · in Torque Game Builder · 06/30/2005 (9:53 pm) · 2 replies
I define a structure XY in c++
struct XY
{
int x;
int y;
};
and I have been registered the XY type to scripting.
I define XY g_Var;g_Var.x =1;g_Var.y =2; then Con::addVariable("g_Var",TypeXY,&g_Var);
below in Scripting .cs
I use echo(g_Var) ,I can see g_Var's value(1 2) in console.log
but I use echo(g_Var.x) ,I don't See g_Var.x 's value.
how can I get single member x or y's Value?
thanks!
struct XY
{
int x;
int y;
};
and I have been registered the XY type to scripting.
I define XY g_Var;g_Var.x =1;g_Var.y =2; then Con::addVariable("g_Var",TypeXY,&g_Var);
below in Scripting .cs
I use echo(g_Var) ,I can see g_Var's value(1 2) in console.log
but I use echo(g_Var.x) ,I don't See g_Var.x 's value.
how can I get single member x or y's Value?
thanks!
Torque Owner Philip Mansfield
Default Studio Name
echo ("g_Var.x=" SPC GetWord (g_Var, 0)); echo ("g_Var.y=" SPC GetWord (g_Var, 1));