How do I get the function name from JSValue created with JS_NewCFunction2 #1127
-
I am using JS_NewCFunction2, however elsewhere in the application (classdef.call ) I need to get the function name as provided to JS_NewCFunction2 from the JSValue - I cannot see any way to do this in quickjs.h? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
PS. I ted using JS_GetPropertyStr but it returns this function name() {
[native code]
} So I tried calling that but it returned null. |
Beta Was this translation helpful? Give feedback.
-
This seems to work: |
Beta Was this translation helpful? Give feedback.
-
That does work if I use the func immediately after creation - but in this case I am trying to get the name of the function inside the logme function (I should have mentioned that before) - it's a generic function I am using to implement IDispatch support. I guess the this_val parameter to the C function is not actually the func object? |
Beta Was this translation helpful? Give feedback.
-
FWIW, I got past this, using a lookup table for the function names and passing the index through the magic parameter. I was just able to successfully run this script function foo() {
var fs = new ActiveXObject('Scripting.FilesystemObject');
var a = fs.CreateTextFile("c:\\temp\\testfile.txt", true);
a.WriteLine("This is a test.");
a.Close();
} Major progress! |
Beta Was this translation helpful? Give feedback.
FWIW, I got past this, using a lookup table for the function names and passing the index through the magic parameter. I was just able to successfully run this script
Major progress!