[phpBB Debug] PHP Notice: in file /viewtopic.php on line 988: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 988: getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4505: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4507: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4508: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4509: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
Yorick - View topic - Pushing back the object in on_eval

 




Reply to topic  [ 3 posts ] 
Pushing back the object in on_eval 
Author Message
Yorick Master

Joined: Tue Mar 07, 2006 10:31 pm
Posts: 125
Location: Meudon, France
Post Pushing back the object in on_eval
Hi,

EDIT: I'm still interested in knowing the answer to this question, but for my case it's actually OK to push a new object with the same content.

I have a plug-in which uses y_userobj_t objects.

In the on_eval callback, I would like to be able to push the object which was evaluated back as return value, an I don't find a way to do so. I can push a copy of the same object, but not the object itself. I want to be able to do things like that:

Code:
> obj1 = MySpecialObject();
> value = obj1 (modify_obj1) (get_value);


as a short-cut for

Code:
> obj1 = MySpecialObject();
> obj1, modify_obj1;
> value = obj1(get_value);


so I would like "obj1(modify_obj1)" to return obj1.

Is there a way to do that?

Best regards, Thibaut.


Mon Mar 28, 2011 1:15 am
Profile WWW
Yorick Guru

Joined: Thu May 10, 2007 12:07 pm
Posts: 62
Post Re: Pushing back the object in on_eval
I remember I did something similar before.

The only (bad) way I found was to return a copy of the object and redefine the "==" operator for these objects in the way that "==" test if, for instance, the two virtually copied object point to the same "data" sub-structure included inside the my y_userobj_t objects.
It works, but I am agree it is not a good solution since you have to use function outside of the yapi.h which can be broken in the future.

I am not very helpful here, but still interested by the solution :)

S.


Wed Mar 28, 2012 1:33 pm
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: Pushing back the object in on_eval
I'm not sure exactly what you need to do here, but I would have guessed that calling ypush_use(yget_use(argc)) would leave a copy of your object on the top of the stack as a return value.


Thu Mar 29, 2012 8:29 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.