{"versions":{"0.1.3":{"name":"fengari-interop","version":"0.1.3","description":"JS library for Fengari","author":{"name":"Daurnimator","email":"quae@daurnimator.com"},"repository":{"type":"git","url":"git+https://github.com/fengari-lua/fengari-interop.git"},"license":"MIT","keywords":["lua","fengari","language"],"bugs":{"url":"https://github.com/fengari-lua/fengari-interop/issues"},"homepage":"https://github.com/fengari-lua/fengari-interop","peerDependencies":{"fengari":"^0.1.0"},"main":"src/js.js","directories":{"lib":"src","test":"test"},"devDependencies":{"eslint":"^8.3.0","fengari":"^0.1.0","jest":"^27.4.0"},"scripts":{"lint":"eslint src/ test/","prepublishOnly":"git diff-index --quiet --cached HEAD -- && npm run lint && npm run test","test":"jest"},"eslintConfig":{"env":{"browser":true,"es6":true,"node":true,"worker":true},"extends":"eslint:recommended","rules":{"indent":["error","tab",{"SwitchCase":1}],"linebreak-style":["error","unix"],"no-empty":[2,{"allowEmptyCatch":true}],"no-unused-vars":[2,{"args":"none"}],"semi":["error","always"]},"overrides":[{"files":["test/*.js"],"env":{"jest":true}}]},"gitHead":"fe5d8c25b0195ff47d043f45563ecf44f9d31665","_id":"fengari-interop@0.1.3","_nodeVersion":"16.11.1","_npmVersion":"8.1.3","dist":{"integrity":"sha512-EtZ+oTu3kEwVJnoymFPBVLIbQcCoy9uWCVnMA6h3M/RqHkUBsLYp29+RRHf9rKr6GwjubWREU1O7RretFIXjHw==","shasum":"3ad37a90e7430b69b365441e9fc0ba168942a146","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/fengari-interop/-/fengari-interop-0.1.3.tgz","fileCount":7,"unpackedSize":57918,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpPHyCRA9TVsSAnZWagAAJs8P/0o+0jT7hsHFuN9OrECo\nLZkwJGnxlBL9RVqWIBIGoT51a21PUNKd6HRYLVNinxAboRAXe+I+o0+5FtGI\nndfpyHTCNVDKkfuC40bpgFA0NhCitvVoI8PmVlTmBn8ilPo4s/rbOH6IQYV/\nh+JbnzCR2nWcxLYs0JTucbthDuZDON3s8T3qoXv/bCyqugC01lw05x+BkLaI\nQ1vCGJc0jjeCP/j/UHxucFkCgu1l+6MoKA4udLgyvSgtbgxtriAic8VvvS5C\nyrn+zP4NL3EY0ANjpHo/wza0ZMhNOHDMs6BC6kQRvpK5QroCvVyhBcM24WLc\nceP2Qusmg16ZVEDMT68aBEWspnHr1wpulK3CWxEtBDI1mNooO8vFJz0w+xOX\njZuse95sj+VCA8vXplGmtpLV8lx5/ZbG8tw//+MiKPaFzfoInwGA90GCdknf\nObE0V8FknMaoS6+yKZicL6v72e7jfUhSyNVxb2WAQhodWBC03hyqlOERRrJ/\n5qltyywd49qG7YNbbqUcG7cX+D+j33+TcZLow+q7vH+yz7C3HBgAviArYqbF\nEw+7bCGc15zqHJfjHvWMnCbMik2r6Hu2g6CjB0EfssRaTsR1CRh3z9D2Lilu\nbTQgSt2AO+4gdj6QmNGLlDGkMlk3wTjO8p62qj1UF0V4wh4bEPilFMhT9M/w\nYgF4\r\n=sEWI\r\n-----END PGP SIGNATURE-----\r\n","size":13248,"noattachment":false},"_npmUser":{"name":"anonymous","email":"quae@daurnimator.com"},"maintainers":[{"name":"anonymous","email":"quae@daurnimator.com"},{"name":"anonymous","email":"giann008@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fengari-interop_0.1.3_1638199794123_0.7213600917431238"},"_hasShrinkwrap":false,"publish_time":1638199794299,"_cnpm_publish_time":1638199794299,"_cnpmcore_publish_time":"2021-12-17T02:14:57.841Z","contributors":[]},"0.1.2":{"name":"fengari-interop","version":"0.1.2","description":"JS library for Fengari","author":{"name":"Daurnimator","email":"quae@daurnimator.com"},"repository":{"type":"git","url":"git+https://github.com/fengari-lua/fengari-interop.git"},"license":"MIT","keywords":["lua","fengari","language"],"bugs":{"url":"https://github.com/fengari-lua/fengari-interop/issues"},"homepage":"https://github.com/fengari-lua/fengari-interop","peerDependencies":{"fengari":"^0.1.0"},"main":"src/js.js","directories":{"lib":"src","test":"test"},"devDependencies":{"eslint":"^4.19.1","fengari":"^0.1.0","jest":"^22.4.3"},"scripts":{"lint":"eslint src/ test/","prepublishOnly":"git diff-index --quiet --cached HEAD -- && npm run lint && npm run test","test":"jest"},"eslintConfig":{"env":{"browser":true,"es6":true,"node":true,"worker":true},"extends":"eslint:recommended","rules":{"indent":["error","tab",{"SwitchCase":1}],"linebreak-style":["error","unix"],"no-empty":[2,{"allowEmptyCatch":true}],"no-unused-vars":[2,{"args":"none"}],"semi":["error","always"]},"overrides":[{"files":["test/*.js"],"env":{"jest":true}}]},"gitHead":"8e59efb7e25469ed1d56dcd065361a1481112e9e","_id":"fengari-interop@0.1.2","_npmVersion":"5.8.0","_nodeVersion":"9.11.1","_npmUser":{"name":"anonymous","email":"quae@daurnimator.com"},"dist":{"shasum":"f7731dcdd2ff4449073fb7ac3c451a8841ce1e87","size":47552,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/fengari-interop/-/fengari-interop-0.1.2.tgz","integrity":"sha512-8iTvaByZVoi+lQJhHH9vC+c/Yaok9CwOqNQZN6JrVpjmWwW4dDkeblBXhnHC+BoI6eF4Cy5NKW3z6ICEjvgywQ=="},"maintainers":[{"name":"anonymous","email":"quae@daurnimator.com"},{"name":"anonymous","email":"giann008@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fengari-interop_0.1.2_1524407092731_0.5552668196358321"},"_hasShrinkwrap":false,"publish_time":1524407092821,"_cnpm_publish_time":1524407092821,"_cnpmcore_publish_time":"2021-12-17T02:14:58.128Z","contributors":[]},"0.1.1":{"name":"fengari-interop","version":"0.1.1","description":"JS library for Fengari","author":{"name":"Daurnimator","email":"quae@daurnimator.com"},"repository":{"type":"git","url":"git+https://github.com/fengari-lua/fengari-interop.git"},"license":"MIT","keywords":["lua","fengari","language"],"bugs":{"url":"https://github.com/fengari-lua/fengari-interop/issues"},"homepage":"https://github.com/fengari-lua/fengari-interop","peerDependencies":{"fengari":"^0.1.0"},"main":"src/js.js","directories":{"lib":"src","test":"test"},"devDependencies":{"eslint":"^4.19.1","fengari":"^0.1.0","jest":"^22.4.3"},"scripts":{"lint":"eslint src/ test/","prepublishOnly":"git diff-index --quiet --cached HEAD -- && npm run lint && npm run test","test":"jest"},"eslintConfig":{"env":{"browser":true,"es6":true,"node":true,"worker":true},"extends":"eslint:recommended","rules":{"indent":["error","tab",{"SwitchCase":1}],"linebreak-style":["error","unix"],"no-empty":[2,{"allowEmptyCatch":true}],"no-unused-vars":[2,{"args":"none"}],"semi":["error","always"]},"overrides":[{"files":["test/*.js"],"env":{"jest":true}}]},"gitHead":"fa936f5e2654d7d5e7a6a6c0df18af8aa07b4eef","_id":"fengari-interop@0.1.1","_npmVersion":"5.7.1","_nodeVersion":"9.10.1","_npmUser":{"name":"anonymous","email":"quae@daurnimator.com"},"dist":{"shasum":"d7f4ec4d6443716a55ca62c5409a0d33020d9869","size":48043,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/fengari-interop/-/fengari-interop-0.1.1.tgz","integrity":"sha512-E2gc3+ax90pQM3STxOClRUN3rCgzdsrELCKYWoESmRv11FxXDKWslmZ8u4pPjTqpGbjUq91b0qlQ9wiWrvvS+g=="},"maintainers":[{"name":"anonymous","email":"quae@daurnimator.com"},{"name":"anonymous","email":"giann008@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fengari-interop_0.1.1_1522759912181_0.1460230552392472"},"_hasShrinkwrap":false,"publish_time":1522759912258,"_cnpm_publish_time":1522759912258,"_cnpmcore_publish_time":"2021-12-17T02:14:58.433Z","contributors":[]},"0.1.0":{"name":"fengari-interop","version":"0.1.0","description":"JS library for Fengari","author":{"name":"Daurnimator","email":"quae@daurnimator.com"},"repository":{"type":"git","url":"git+https://github.com/fengari-lua/fengari-interop.git"},"license":"MIT","keywords":["lua","fengari","language"],"bugs":{"url":"https://github.com/fengari-lua/fengari-interop/issues"},"homepage":"https://github.com/fengari-lua/fengari-interop","peerDependencies":{"fengari":"^0.1.0"},"main":"src/js.js","directories":{"lib":"src","test":"test"},"devDependencies":{"eslint":"^4.19.1","fengari":"^0.1.0","jest":"^22.4.3"},"scripts":{"lint":"eslint src/ test/","prepublishOnly":"git diff-index --quiet --cached HEAD -- && npm run lint && npm run test","test":"jest"},"eslintConfig":{"env":{"browser":true,"es6":true,"node":true,"worker":true},"extends":"eslint:recommended","rules":{"indent":["error","tab",{"SwitchCase":1}],"linebreak-style":["error","unix"],"no-empty":[2,{"allowEmptyCatch":true}],"no-unused-vars":[2,{"args":"none"}],"semi":["error","always"]},"overrides":[{"files":["test/*.js"],"env":{"jest":true}}]},"gitHead":"0f7a3f6e9461d32cf2e4a9b4da2d34b159d93059","_id":"fengari-interop@0.1.0","_npmVersion":"5.7.1","_nodeVersion":"9.9.0","_npmUser":{"name":"anonymous","email":"quae@daurnimator.com"},"dist":{"shasum":"07bc8724cb7b1877e1dc9a2f7cda8364df887f68","size":48182,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/fengari-interop/-/fengari-interop-0.1.0.tgz","integrity":"sha512-6RjjvpgmFVnhhLmEwX4VC/lMGbK90Mo5ym/EQ7mVlMRapE2qbW7b5t5IUTalccymA0bbHHZfoEyhUeGXScYOJQ=="},"maintainers":[{"name":"anonymous","email":"quae@daurnimator.com"},{"name":"anonymous","email":"giann008@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fengari-interop_0.1.0_1522503414981_0.7985952785497963"},"_hasShrinkwrap":false,"publish_time":1522503415085,"_cnpm_publish_time":1522503415085,"_cnpmcore_publish_time":"2021-12-17T02:14:58.717Z","contributors":[]},"0.1.4":{"name":"fengari-interop","version":"0.1.4","description":"JS library for Fengari","author":{"name":"Daurnimator","email":"quae@daurnimator.com"},"repository":{"type":"git","url":"git+https://github.com/fengari-lua/fengari-interop.git"},"license":"MIT","keywords":["lua","fengari","language"],"bugs":{"url":"https://github.com/fengari-lua/fengari-interop/issues"},"homepage":"https://github.com/fengari-lua/fengari-interop","peerDependencies":{"fengari":"^0.1.0"},"main":"src/js.js","directories":{"lib":"src","test":"test"},"devDependencies":{"eslint":"^9.39.1","fengari":"^0.1.0","globals":"^16.5.0","jest":"^30.2.0"},"scripts":{"lint":"eslint src/ test/","prepublishOnly":"git diff-index --quiet --cached HEAD -- && npm run lint && npm run test","test":"jest"},"gitHead":"e1eec1af192898cd6786bcd108e22feb40b097e3","_id":"fengari-interop@0.1.4","_nodeVersion":"25.2.1","_npmVersion":"11.6.4","dist":{"integrity":"sha512-4/CW/3PJUo3ebD4ACgE1g/3NGEYSq7OQAyETyypsAl/WeySDBbxExikkayNkZzbpgyC9GyJp8v1DU2VOXxNq7Q==","shasum":"d4ececf28720f42caa7c449f5361ab8dcb00343f","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/fengari-interop/-/fengari-interop-0.1.4.tgz","fileCount":8,"unpackedSize":58152,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCttDMQRDLDZTzOpnwIRowrd0wHE4D4xtzlGWNUf7HJ2QIhAOb/BhRWp9D73XBlIwiG0bI5nPomelyRBAG41h/MoVgJ"}],"size":13437},"_npmUser":{"name":"anonymous","email":"quae@daurnimator.com"},"maintainers":[{"name":"anonymous","email":"giann008@gmail.com"},{"name":"anonymous","email":"quae@daurnimator.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fengari-interop_0.1.4_1766294139248_0.6685338646462622"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-12-21T05:15:39.400Z","publish_time":1766294139400,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"0.1.4"},"name":"fengari-interop","time":{"created":"2022-01-26T23:14:57.362Z","modified":"2025-12-21T05:15:48.478Z","0.1.3":"2021-11-29T15:29:54.299Z","0.1.2":"2018-04-22T14:24:52.821Z","0.1.1":"2018-04-03T12:51:52.258Z","0.1.0":"2018-03-31T13:36:55.085Z","0.1.4":"2025-12-21T05:15:39.400Z"},"readme":"[![Build Status](https://github.com/fengari-lua/fengari-interop/actions/workflows/ci.yaml/badge.svg)](https://github.com/fengari-lua/fengari-interop/actions/workflows/ci.yaml?query=event%3Apush)\n[![npm](https://img.shields.io/npm/v/fengari-interop.svg)](https://npmjs.com/package/fengari-interop)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![#fengari on libera.chat](https://img.shields.io/badge/chat-%23fengari-brightgreen)](https://web.libera.chat/?channels=#fengari)\n\n\n# JS library for Fengari\n\n[Fengari](https://github.com/fengari-lua/fengari) is a lua VM written in Javascript.\nIts implementation makes use of the JS garbage collector, which means it is fully capable of cross language interop.\n\n## Features\n\n  - Call any JS function from Lua\n  - Give Lua tables/functions/userdata to Javascript\n\n\n## `js` library\n\n```lua\njs = require \"js\"\n```\n\n### `null`\n\nA userdata representing JavaScript [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null)\n\n\n### `global`\n\nA reference to the JavaScript global context. In the browser, this is usually equivalent to the `window` object. In node.js it's equal to [`global`](https://nodejs.org/api/globals.html#globals_global).\n\n\n### `new(constructor, ...)`\n\nInvokes the JavaScript [`new` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new) on `constructor` passing the arguments specified.\n\nReturns the created object.\n\n\n### `of(iterable)`\n\nReturns a iterating function and an iterator state that behave like a JavaScript [for...of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) loop.\nSuitable for use as a lua iterator. e.g.\n\n```lua\nfor f in js.of(js.global:Array(10,20,30)) do\n\tprint(f)\nend\n```\n\n*Note: this function only exists if the JavaScript runtime supports [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)*\n\n\n### `createproxy(x[, type])`\n\n*Note: Only available if your JS environment has the `Proxy` constructor*\n\nCreates a JavaScript [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) object. The proxy supports configuring traps by setting them as metamethods on your object.\n\n`type` may be `\"function\"` (the default) `\"arrow_function\"` or `\"object\"`:\n\n  - `\"function\"`:\n      - `typeof p === \"function\"`\n      - Can be used as a constructor\n  - `\"arrow_function\"`:\n      - `typeof p === \"function\"`\n      - Can **not** be used as a constructor\n  - `\"object\"`:\n      - `typeof p === \"object\"`\n      - Can **not** be used as a constructor\n\nNote that JavaScript coerces all types except Symbols to strings before using them as a key in an indexing operation.\n\n\n### `tonumber(x)`\n\nCoerces the value `x` to a number using JavaScript coercion rules.\n\n\n### `tostring(x)`\n\nCoerces the value `x` to a string using JavaScript coercion rules.\n\n\n### `instanceof(x, y)`\n\nReturns if the value `x` is an instance of the class `y` via use of the JavaScript [`instanceof` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof)\n\n\n### `typeof(x)`\n\nReturns what JavaScript sees as the type of `x`. Uses the JavaScript [`typeof` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof)\n\n\n## JavaScript API\n\n### `push(L, value)`\n\nPushes an arbitrary JavaScript object `value` as the most suitable lua type onto the lua stack `L`.\nPerforms deduplication so that the same JavaScript objects are pushed as the same lua objects.\n\n\n### `pushjs(L, value)`\n\nPushes an arbitrary JavaScript object `value` as a userdata onto the lua stack `L`.\nRarely used; see `push(L, value)` instead.\n\n\n### `checkjs(L, idx)`\n\nIf the value on the lua stack `L` at index `idx` is a JavaScript userdata object (as pushed by `push` or `pushjs`) then return it.\nOtherwise throw an error.\n\n\n### `testjs(L, idx)`\n\nIf the value on the lua stack `L` at index `idx` is a JavaScript userdata object (as pushed by `push` or `pushjs`) then return it.\nOtherwise returns `undefined`.\n\n\n### `tojs(L, idx)`\n\nReturns the object on the lua stack `L` at index `idx` as the most suitable javascript type.\n\n  - `nil` is returned as `undefined`\n  - booleans are returned as booleans\n  - numbers are returned as numbers\n  - strings are returned as JavaScript strings\n    (Note: this *can* throw an error if the lua string is not represenable as a JavaScript string)\n  - JavaScript userdata object (as pushed by `push` or `pushjs`) returns the pushed JavaScript object\n  - Other objects are returned wrapped in a JavaScript function object with methods:\n      - `apply(this, [args...])`: calls the lua object. Returns only the first return value\n      - `invoke(this, [args...])`: calls the lua object. Returns results as an array\n      - `get(key)`: indexes the lua object\n      - `has(key)`: checks if indexing the lua object results in `nil`\n      - `set(key, value)`\n      - `delete(key)`: sets the key to `nil`\n      - `toString()`\n    JavaScript arguments to these methods are passed in via `push()` and results are returned via `tojs()`.\n    Calling the function is equivalent to calling the lua function wrapped.\n\n\n### `luaopen_js`\n\nThe entrypoint for loading the [js library](#js-library) into a fengari `lua_State`.\nUsually passed to `luaL_requiref`.\n\n\n## Symbols\n\nIf the JavaScript environment supports [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol), then some runtime-wide symbols can be used to customise behaviour:\n\n### `__pairs`\n\nThe `__pairs` Symbol can be used to describe how to iterate over a JavaScript object. Use `Symbol.for(\"__pairs\")` to get the symbol. It should be used as a key on your objects, where the value is a function returning an object with three properties: `\"iter\"`, `\"state\"` and `\"first\"`.\n\n`\"iter\"` should be a function that follows the standard [Lua generic for protocol](http://www.lua.org/manual/5.3/manual.html#3.3.5), that is, it gets called with your *state* (as `this`) and the previous value produced; it should return an array of values or `undefined` if done.\n\ne.g. to make `pairs` on a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) return entries in the map via the [iterator symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@iterator):\n\n```js\nMap.prototype[Symbol.for(\"__pairs\")] = function() {\n\treturn {\n\t\titer: function(last) {\n\t\t\tvar v = this.next();\n\t\t\tif (v.done) return;\n\t\t\treturn v.value;\n\t\t},\n\t\tstate: this[Symbol.iterator]()\n\t};\n};\n```\n\nIf there is no `__pairs` Symbol attached to an object, an iterator over [`Object.keys`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) is returned.\n\n\n### `__len`\n\nThe `__len` Symbol can be used to describe how to get the length (used by the lua `#` operator) of a JavaScript object.\nUse `Symbol.for(\"__len\")` to get the symbol. It should be used as a key on your objects, where the value is a function returning the length of your objects (passed as `this`).\n\ne.g. to have the lua `#` operator applied to a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) return the [`size`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size) field:\n\n```js\nMap.prototype[Symbol.for(\"__len\")] = function() {\n\treturn this.size;\n};\n```\n\nIf there is no `__len` Symbol attached to an object, the value of the `.length` property is returned.","users":{}}