name: duk_push_current_function proto: | void duk_push_current_function(duk_context *ctx); stack: | [ ... ] -> [ ... func! ] (if current function exists) [ ... ] -> [ ... undefined! ] (if no current function) summary: |

Push the currently running function to the stack. The value pushed is an Ecmascript Function object. If there is no current function, undefined is pushed instead.

If the current function was called via one or more bound functions or a Proxy object, the function returned from this call is the final, resolved function (not the bound function or the Proxy).

This function allows a C function to gain access to its function object. Since multiple function objects can internally point to the same C function, a function object is a convenient place for function parameterization and can also act as an internal state stash.

example: | duk_push_current_function(ctx); tags: - stack - function introduced: 1.0.0