Page 1 of 1

Questionable game.player.print() optimizations.

Posted: Wed Aug 05, 2015 4:33 pm
by Adil
If the string passed to game.player.print() is the same as the one passed in previous call, it is not output. (Well, if typed manually, it is.)

Code: Select all

/c for _,i in pairs{0,0,0,0} do game.player.print(i); end
produces output
0
Is it really a reasonable behavior?
It raises problems for debugging when quickly checking a number of different variables:

Code: Select all

a=1; b=1; c=2; d=1;
game.player.print(a);
game.player.print(b);
game.player.print(c);
game.player.print(d);
1
2 <-which element is this?
1
or

Code: Select all

a=1; b=1;
game.player.print(a);
game.player.print(b);
a=a+b;
game.player.print(a);
game.player.print(b);
 
1
2
1
Such snippets are often temporarily placed in code just to check this or that (well, at least often placed by me), so typing any additional unique strings to identify what is that printed is not very handy. Positional identification on the other hand is cheap and quick way of achieving only slightly less degree of recognition of outputs.

Re: Questionable game.player.print() optimizations.

Posted: Wed Aug 05, 2015 5:05 pm
by kovarex
I understand it, but the mechanism is used to avoid spam of messages in certain situation (like full inventory, can't build etc).

You can always change the messages to contain unique number or something.