aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-15 18:13:14 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-15 18:13:14 +1000
commit424a3604dd90a40773e3434450bb5cb685962926 (patch)
tree1341293fc52c8e7decdb05ad3bea9ed27bc33fa0
parent2d7fb6bf929295a058b8a0634d180a570590eb4a (diff)
downloadfengari-424a3604dd90a40773e3434450bb5cb685962926.tar.gz
fengari-424a3604dd90a40773e3434450bb5cb685962926.tar.bz2
fengari-424a3604dd90a40773e3434450bb5cb685962926.zip
README.md: Add Extensions section
-rw-r--r--README.md46
1 files changed, 46 insertions, 0 deletions
diff --git a/README.md b/README.md
index f40660a..a41b94b 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,52 @@
- [ ] DOM API binding: [https://github.com/fengari-lua/fengari-interop](https://github.com/fengari-lua/fengari-interop)
+## Extensions
+
+### `dv = lua_todataview(L, idx)`
+
+Equivalent to `lua_tolstring` but returns a [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instead of a string.
+
+
+### `str = lua_toljsstring(L, idx)`
+
+Equivalent to `lua_tolstring` but returns the string as a JavaScript string (as if `to_jsstring()` was called on the result).
+
+
+### `lua_tojsstring(L, idx)`
+
+Alias for `lua_toljsstring`.
+
+
+### `lua_pushjsfunction(L, func)`
+
+Alias for `lua_pushcfunction`.
+
+
+### `lua_pushjsclosure(L, func, n)`
+
+Alias for `lua_pushcclosure`.
+
+
+### `b = lua_isproxy(p, L)`
+
+Returns a boolean `b` indicating whether `p` is a proxy (See `lua_toproxy`).
+If `L` is non-null, only returns `true` if `p` belongs to the same global state.
+
+
+### `p = lua_toproxy(L, idx)`
+
+Returns a JavaScript object `p` that holds a reference to the lua value at the stack index `idx`.
+This object can be called with a lua_State to push the value onto that state's stack.
+
+This example would be an inefficient way to write `lua_pushvalue(L, 1)`:
+
+```js
+var p = lua_toproxy(L, 1);
+p(L);
+````
+
+
## References
- [Source code for Lua 5.3](lua.org/source/5.3/)