Game Development Community

Global Namespace Parameters

by John Casamassina · in iTorque 2D · 05/07/2010 (11:33 am) · 7 replies

exec("test.cs");
%two = 2;
%three = 3;
%four = 4;
echo(test::double(%three));
echo(test::add(%two, %four));
echo(test::add(2, 4));


in test.cs:
function test::add(%number1, %number2)
{
%number1 = %number1 + 0; // must be reassigned
%number2 = %number2 + 0;
return %number1 + %number2;
}
function test::double(%number)
{
%number = test::add(%number, %number);
return %number;
}

#1
05/07/2010 (12:02 pm)
Just to clarify the bug is only present using PUAP_OPTIMIZE
#2
05/14/2010 (12:50 pm)
What's the actual bug you are reporting? Could you put it in our reporting format?

(what version are you using?)
Build: 1.4 Beta 1, 1.4 Beta 2, or 1.4 Release

(what platform/OS did this happen on?)
Platform: Windows Vista/7/XP, OS X 10.6.x, Simulator, iPad, iPhone, and/oriPod

(where is this bug happening?)
Target: Editors, Stand Alone (iTorque2DGame.app), and/or On Device

(what is the bug)
Issues: In the iPhoneExample and iPhoneiPodExample projects, clicking on the arrows does nothing.

(tell us how to trigger the bug)
Steps to Repeat:
1. Run TGB editor.
2. Open iPhoneExample project
3. Run game from editor
4. Clicking on arrows does nothing
5. Same happens when running iTorque2DGame.app and deploying to Simulator/Device.

(if you know the solution, please post it. not required)
Suggested Fix: Check compiler and project settings for physics disabled.

(if you have a copy of your console log, please link to it here)
Link to Console Log: Log
#3
05/14/2010 (1:05 pm)
Build: 1.3.1
Platform: iPhone
Target: Stand Alone / Device
Issues: In functions that have a global namespace, parameters are null
Steps to Repeat: Code above, output is unexpected
#4
05/17/2010 (2:51 am)
I cant reproduce this, i have the following setup :

1.4 beta code, rebuilt executable (to be sure). Its definately got script optimise and script change. I am using the iPhoneExample project, and i added the top code to game.cs and the test.cs file to the project in torsion.

a) i modified to code to be the following :

exec("game/scripts/test.cs");
   %two = 2;
   %three = 3;
   %four = 4;
   
   echo(test::double(%three));
   echo(test::add(%two, %four));
   echo(test::add(2, 4));
      
//and inside the other script.
function test::add(%number1, %number2)
{
   echo("add :: got " @ %number1 @ " and " @ %number2);
   return %number1 + %number2;
}

function test::double( %number)
{
   echo("double :: Got " @ %number);
   %number1 = test::add(%number, %number);
   return %number1;
}

Stepping through with torsion, not stepping through, running standlone, all console output is correct.

img69.imageshack.us/img69/8916/screenshot215m.jpg
Anything im missing? i dont have 1.3.1 currently so i tried in 1.4.
#5
05/17/2010 (7:47 am)
Could you verify this with 1.3.1? If this has been fixed in 1.4 then it will just be a matter of tracking down the files changed related to this.
#6
05/17/2010 (7:55 am)
You also removed the assignments in add, even though in the example they are useless, the values must be reassigned to present the bug. Same goes for double, you created a new variable %number1.
#7
05/17/2010 (3:43 pm)
I'm not sure if these are really bugs or if it is a consequence of the tightened handling in PUAP_OPTIMIZE in combination with the attempt to write into a local version of a global variable.

that normally would require that the function creates own heap space to have an own local copy and I think especially that end is among the things that are optimized on PUAP_Optimize as they are among the things on the pure script execution that cost most time