C++ to Skookum calling


#1

Hello.

Is there any example of using coroutine_call by C++ to Skookum?
What is SKInstance** args_pp and what doing with this?
I’m completely at a loss.
Need what any examples.

Thanks!


#2

Yes, the SkookumScript C++ API is still light on documentation other than the C++ code comments.

This is a related thread that might help:

Some of the related classes used in a coroutine_call():

  • SkInstance: the C++ data structure that represents any type of object in SkookumScript: numbers, strings, nil, characters, trigger regions, anything. Routine calls are made on instance objects and the arguments (args_pp is an array of instance arguments and arg_count indicates how many they are) that are passed to routines are also instance objects. Method calls can return a result instance object too. Most SkookumScript datatypes have a new_instance() method that makes them into a usable SkInstance. Search the code for setting SkookumScript returned results *result_pp = for several examples of simple instances.
  • ASymbol: essentially a type of fast string that is like a mashup of a string and an enumerated type. It is what SkookumScript uses for all named things such as: class names, routine names, data member names, etc. You can make a ASymbol from a string (AString) though the conversion has a time cost so it is good to reuse a premade symbol when possible.
  • SkInvokedCoroutine: any coroutine that doesn’t finish in one frame will return an invoked coroutine as its running environment. It contains its call stack, arguments, local variables, etc. It can be queried on successive frames to determine when it has completed. It can also be suspended so that its execution is paused.

There are even more sophisticated concepts around calling a coroutine though this is a good start.

I didn’t see any examples of coroutine_call() though there are a few method_call() around that are similar. We’ll try to add some in future tutorials and examples.

Feel free to ask additional questions in the area and we’ll try to help.