Page 1 of 1
Accessing to gamestate args from php side
Posted: 06 March 2013, 17:09
by Alkazar
Hello,
Is there a way to access gamestate args array from the php side ? Just in order to avoid unnecessary calls to some functions already called to calculate the args.
I've tried this-> gamestate->state_args but as it is defined as private ...
Re: Accessing to gamestate args from php side
Posted: 06 March 2013, 17:10
by sourisdudesert
Hello,
Thank you for using BGA Studio
Basically: no.
The best thing to do is the following:
- Create a utility function that return the state args.
- Use it in your "argMyMethod" to generate the result
- Use it anywhere else

Hope this answer the question

Re: Accessing to gamestate args from php side
Posted: 06 March 2013, 17:18
by Alkazar
Well it is what I'm already doing but as I was trying to optimize my code I thought it was a pity to call functions like "calculate possible moves" twice.
Re: Accessing to gamestate args from php side
Posted: 06 March 2013, 17:39
by sourisdudesert
Hi,
What you can use them is a local member variable to store the result. Something like:
Code: Select all
if( $this->stored_result )
{
return $this->stored_result;
}
else
{
$this->stored_result = self::get_possible_moves_compute();
return $this->stored_result;
}