I
On Sep 29, 1:58 pm, Sébastien <[EMAIL PROTECTED]> wrote:
> The function returns a v8::Integer, and looks like this.
>
> v8::Handle<v8::Value> posix_time(const v8::Arguments& args) {
> v8::HandleScope handlescope;
Do you really want a handle scope here since v8::Integer::New will
return a local handle?
> return v8::Integer(time(NULL));
I think you mean
return v8::Integer::New(...);
>
> }
>
> You can see how this is used in context here <http://github.com/
> sebastien/k7/tree/master/lib/system/posix>.
>
> -- Sébastien
>
> On 28 sep, 22:29, Pete Gontier <[EMAIL PROTECTED]> wrote:
>
> > You haven't shown us the source for the function posix_time. What does
> > it return?
>
> > On Sep 28, 2008, at 3:57 PM, Sébastien wrote:
>
> > > Hi,
>
> > > I have a problem when using Object->Set in this specific code:
>
> > > module->Set(String:new("time"),v8::FunctionTemplate::New(posix_time)-
> > >> GetFunction());
>
> > > When I later execute javascript code that accesses the "time" property
> > > of the module object, I get "undefined" as a value. However, if I do:
>
> > > module->Set(String:new("time"),String:new("foo"));
>
> > > Then "foo" will be returned as the "time" property of the module
> > > object. Even more strangely, if I do:
>
> > > module->Set(String:new("time"),String:new("foo"));
> > > module->Set(String:new("time"),v8::FunctionTemplate::New(posix_time)-
> > >> GetFunction());
>
> > > The the "time" property will still be "foo" (while it should be
> > > undefined) -- so it looks like the second "module->Set" does not
> > > produce any effect.
>
> > > Any ideas ?
>
> > > -- Sébastien
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---