Re: how to do native calls in shen-js

51 views
Skip to first unread message

Ramil Farkhshatov

unread,
May 17, 2013, 1:05:37 AM5/17/13
to qil...@googlegroups.com
ăzvan Rotaru <razvan...@gmail.com> wrote:

> How can I call a native JS function from shen-js?

You have to define a wrapper first:

// a sample of wrapper for 3-place function
Shen.mkfunction("some-func", 3, function f(args) {
if (args.length < 3) return [Shen.type_func, f, 3, args]
return some_func(args[0], args[1], args[2])
})

You can put all required wrappers in a file which you can load from Shen by:

(shenjs.load "wrappers.js")
Reply all
Reply to author
Forward
0 new messages