This PR simplifies the process to push a named native function to the Duktape stack:
sbx.push_global_proc("test", 0) do |ptr|
env = Duktape::Sandbox.new ptr
env << 42
env.call_success
end
sbx.eval!("test();") # => 42
This PR also adds the env.call_success, env.call_failure and env.return_undefined helpers to return the proper integer status codes from a native call.
Note: call_failure may optionally take a symbol that will define the type of error object pushed to the stack after a call.
This PR simplifies the process to push a named native function to the Duktape stack:
This PR also adds the
env.call_success
,env.call_failure
andenv.return_undefined
helpers to return the proper integer status codes from a native call.Note:
call_failure
may optionally take a symbol that will define the type of error object pushed to the stack after a call.Here's the current possible symbols:
So for example: