Commit f35ea626 authored by Johny Mattsson's avatar Johny Mattsson
Browse files

Documented previously undocumented node functions.

parent 63ccdd06
# node Module # node Module
The node module provides access to system-level features such as sleep, restart and various info and IDs. The node module provides access to system-level features such as sleep, restart and various info and IDs.
## node.bootreason()
Returns the boot reason code.
This is the raw code, not the new "reset info" code which was introduced in recent SDKs. Values are:
- 1: power-on
- 2: reset (software?)
- 3: hardware reset via reset pin
- 4: WDT reset (watchdog timeout)
####Syntax
`node.bootreason()`
####Parameters
`nil`
####Returns
number:the boot reason code
####Example
```lua
rsn = node.bootreason()
```
___
## node.restart() ## node.restart()
Restarts the chip. Restarts the chip.
...@@ -335,3 +359,35 @@ This also uses the SDK function `system_restore()`, which doesn't document preci ...@@ -335,3 +359,35 @@ This also uses the SDK function `system_restore()`, which doesn't document preci
node.restart() -- ensure the restored settings take effect node.restart() -- ensure the restored settings take effect
``` ```
___ ___
## node.stripdebug()
Controls the amount of debug information kept during `node.compile()`, and
allows removal of debug information from already compiled Lua code.
Only recommended for advanced users, the NodeMCU defaults are fine for almost all use cases.
####Syntax
`node.stripdebug([level[, function]])``
####Parameters
- `level`:
- 1: don't discard debug info
- 2: discard Local and Upvalue debug info
- 3: discard Local, Upvalue and line-number debug info
- function: a compiled function to be stripped per setfenv except 0 is not permitted.
If no arguments are given then the current default setting is returned. If function is omitted, this is the default setting for future compiles. The function argument uses the same rules as for `setfenv()`.
#### Returns
If invoked without arguments, returns the current level settings. Otherwise, `nil` is returned.
####Example
```lua
node.stripdebug(3)
node.compile('bigstuff.lua')
```
####See also
- `node.compile()`
___
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment