Re: [v8-users] question on the sample file process.cc

2017-07-02 Thread Jakob Kummerow
If you look at the source of gin::V8ToString, you will see that it only handles string arguments. Try output[request.host] = "1", or consider using a map, or change your implementation to perform number-to-string conversions as needed. On Fri, Jun 30, 2017 at 10:38 PM, wxz

Re: [v8-users] question on the sample file process.cc

2017-06-30 Thread wxz
Thanks for the explanation, but it's still blur to me. I'm trying to wrap those two maps into an interceptor class. Please see the attached. It works for lines such as: if (option.verbose) but it fails on lines: output[request.host] = 1; The script runs, but the final output is:

Re: [v8-users] question on the sample file process.cc

2017-06-30 Thread Jakob Kummerow
There are no conversions happening. In the script, "output" is a regular JavaScript object, with all the behavior you would expect. On the C++ side, "output" is a map, but "output_obj" is a JavaScript object created from that map (via the WrapMap(output) call), and that's what's

Re: [v8-users] question on the sample file process.cc

2017-06-30 Thread wxz
a follow up question, in the script, the 'output' map is used as map: output[request.host] = 1; output[request.host]++ however, it's a map in c++ side, which part of the c++ code handles such conversion? On Thursday, June 29, 2017 at 5:07:20 PM UTC-4, Jakob

Re: [v8-users] question on the sample file process.cc

2017-06-29 Thread wxz
YES! Thanks. On Thursday, June 29, 2017 at 5:07:20 PM UTC-4, Jakob Kummerow wrote: > > The equivalent of options.verbose is options["verbose"] (note the > quotes). Does that help? > > On Thu, Jun 29, 2017 at 10:07 PM, wxz > wrote: > >> hi all, >> >> there are two maps

Re: [v8-users] question on the sample file process.cc

2017-06-29 Thread Jakob Kummerow
The equivalent of options.verbose is options["verbose"] (note the quotes). Does that help? On Thu, Jun 29, 2017 at 10:07 PM, wxz wrote: > hi all, > > there are two maps used in this example, one for 'options', one for > 'output'. My question is, why is that in the script,

[v8-users] question on the sample file process.cc

2017-06-29 Thread wxz
hi all, there are two maps used in this example, one for 'options', one for 'output'. My question is, why is that in the script, the brackets [] works for 'output', but not for 'options'? For example, if change the line: options.verbose ===> options[verbose] it returns error: verbose is not