natiny_script_get_error

C
const char* natiny_script_get_error(NatinyScript script);

Returns the diagnostic message from the last failed run or call in the state.

Parameters

Name Type Description
script NatinyScript The state to ask

Returns

Type Description
const char* State-owned message, or "" when no current error exists; never NULL

Example

C
if (!natiny_script_call(script, "on_save", NULL, 0, NULL, NULL)) {
    fprintf(stderr, "on_save: %s\n", natiny_script_get_error(script));
}

Notes

  • The pointer belongs to the state and remains valid until the next natiny_script_run, natiny_script_call or natiny_script_call_value, or until the state is destroyed.