How to call java script functions in objective C in cocos2d JS - cocos2d-x

How to call java script functions in objective C in cocos2d JS.
I found JS to Objective C here.
Now i am trying JS to objective C calling.
Can any one help me.

here is the official document.
if you want to call more than static method, you may write js-binding codes,there are many samples in cocos2dx-js source code.

Related

function ta.rsi Pinescript on TradingView

I dont't understand why my script doesn't save my function ta.rsi(close,9).
I have the same problem with math.max
I think I didn't make a mistake in my code
Those ta. and math. namespaces have been introduced in v5.
It looks like your pinescript is in an older version.
You should call those functions without the namespaces.
vrsi = rsi(close, 9)

How to access the asyncio / uvloop loop from C

I'm completely new to python, but have an async python app using uvloop which uses a C api module I created which also needs access to the async loop.
1) asyncio does not yet have a c-api for this? Any hacks to get an event loop usable in C? Is this being discussed anywhere?
2) uvloop uses libuv which I am familiar with in C. If I can grab the uv_loop_t pointer I could hook into the loop. I assume I can either:
A) With a PyObject * to uvloop's loop calculate the offset to the uv_loop_t* and use that? Assuming I knew the length of PyObject_HEAD?
libuv_loop = (uv_loop_t*)((void*)(loop)+0x8);
struct __pyx_obj_6uvloop_4loop_Loop {
PyObject_HEAD
uv_loop_t *uvloop;
B) Or non hacky modify uvloop to expose the loop pointer. I'm completely clueless here as I've never looked at cython code. Can I create a python function on the loop, call it from my C code and get the C pointer? Like:
(uv_loop_t*)PyObject_CallFunctionObjArgs( getLoop, NULL )
By adding getLoop to here:
https://github.com/MagicStack/uvloop/blob/master/uvloop/loop.pyx
cdef uv.uv_loop_t* _getLoop(self):
return self.uvloop
asyncio has no C API yet.
We have a plan for adding it in future Python versions (3.8 maybe).
Right now you should use PyObject_* api.
uvloop is written in Cython but the library has no Public C API as well. You may access private uvloop API but exposed function names and data structures can be changed in any moment without public notice because they are considered private, users should never use it.
Was looking for this too, and coincidentally, it just so happens that uvloop added a loop.get_uv_loop_t_ptr() method a few days ago :)
https://github.com/MagicStack/uvloop/pull/310
Now we just have to wait for a new release (v0.17 ?) that includes this PR (or build it ourselves).

Using Delphi component under C++ Builder makes calls to a wrong function

I'm trying to use Graphics32 package. Graphics32 was compiled and installed without any issue.
When I try to execute (debug) following code under C++ Builder XE3
TBitmap32* bmp = new TBitmap32();
bmp->LoadFromFile("d:\\sample.bmp");//This calls SaveToStream instead of LoadFromFile
...
it calls another member function SaveToStream which I can trace into and step while debugging until AV rises.
I have never encountered such behavior before.
Is there any compiler directive I'm missing or some workaround to make proper function call?
Update: I use the Graphics32 source from SVN. Everything works good if I use code prior to revision 2122.

Can an embedded cocos2d-js app call back out to c++?

I'm researching the possibility of using cocos2d-js by embedding it as a view inside an existing iOS app. In order to make this work, I'm going to need 2-way communication between cocos2d and the surrounding application.
After some initial investigation, I have determined that it is possible to call in to cocos using ScriptingCore:
ScriptingCore* sc = ScriptingCore::getInstance();
jsval outVal;
sc->evalString("function()", &outVal);
My question, then, is around doing the reverse. It is possible to (e.g. in response to user input) call back out of cocos2d-js to C++? Ideally, there would be a way to register a callback with ScriptingCore which could be invoked from JavaScript.
I believe it can be done, but I have not tried myself, nor can I find a good and concise example.
All I can do is point you at SuperSuraccoon's Bluetooth example and it's git page, which apparently does both ways communication between C++ and JS code.

How can I write a function in Selenium and call it from another page?

I'm new to Selenium. I need to write a function in Selenium. This is a sample code. If it is correct, where we will save this file and what is the extension? How can I call this function from another page?
Please help me.
Can you give me sample code for a function in Selenium?
package com.example.tests;
public void chk_test(String news){
System.out.println("Success");
}
For starters, use an IDE, such as Eclipse.
Within the same project, you should be able to create different packages, and import com.example.tests; within a class to use your function as chk_test(aString);
Hope this helps get you started. There are tons of articles/tutorials to get setup with Selenium RC using Eclipse, programming in Java.