wrenbind17::Variable #
Module: Wrenbind17
Holds some Wren variable which can be a class or class instance. More…
#include <variable.hpp>
Public Functions #
Name | |
---|---|
Variable() | |
Variable(const std::shared_ptr< Handle > & handle) | |
~Variable() | |
Method | func(const std::string & signature)Looks up a function from this Wren variable. |
Handle & | getHandle() |
const Handle & | getHandle() const |
operator bool() const | |
void | reset() |
Detailed Description #
class wrenbind17::Variable;
Holds some Wren variable which can be a class or class instance.
Note: This variable can safely outlive the wrenbind17::VM class. If that happens then functions of this class will throw wrenbind17::RuntimeError exception. This holder will not try to free the Wren variable if the VM has been terminated. You don’t have to worry about the lifetime of this holder. (uses weak pointers).
You can use this to pass around Wren classes or class instances. You can also use this to get Wren class methods. You can also call a Wren function from C++ side and pass this Variable into Wren. To get this variable, either call a Wren function that returns some class (or class instance), or use wrenbind17::VM::find() function that looks up a class (or class instance) based on the module name.
Public Functions Documentation #
function Variable #
inline Variable()
function Variable #
inline Variable(
const std::shared_ptr< Handle > & handle
)
function ~Variable #
inline ~Variable()
function func #
inline Method func(
const std::string & signature
)
Looks up a function from this Wren variable.
Exceptions:
- RuntimeError if this variable is invalid or the Wren VM has terminated.
The signature must match Wren function signature. For example: main()
or foo(_,_)
etc. Use underscores to specify parameters of that function.
function getHandle #
inline Handle & getHandle()
function getHandle #
inline const Handle & getHandle() const
function operator bool #
inline operator bool() const
function reset #
inline void reset()
Updated on 17 October 2023 at 12:26:25 UTC