Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
acddf29f
Commit
acddf29f
authored
Mar 04, 2016
by
TerryE
Browse files
Address Philip's review comments
parent
9977b13b
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/modules/node.c
View file @
acddf29f
...
@@ -453,7 +453,6 @@ static int node_compile( lua_State* L )
...
@@ -453,7 +453,6 @@ static int node_compile( lua_State* L )
static
task_handle_t
do_node_task_handle
;
static
task_handle_t
do_node_task_handle
;
static
void
do_node_task
(
task_param_t
task_fn_ref
,
uint8_t
prio
)
static
void
do_node_task
(
task_param_t
task_fn_ref
,
uint8_t
prio
)
{
{
UNUSED
(
prio
);
lua_State
*
L
=
lua_getstate
();
lua_State
*
L
=
lua_getstate
();
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
(
int
)
task_fn_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
(
int
)
task_fn_ref
);
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
(
int
)
task_fn_ref
);
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
(
int
)
task_fn_ref
);
...
@@ -472,7 +471,7 @@ static int node_task_post( lua_State* L )
...
@@ -472,7 +471,7 @@ static int node_task_post( lua_State* L )
Ltype
=
lua_type
(
L
,
++
n
);
Ltype
=
lua_type
(
L
,
++
n
);
}
}
luaL_argcheck
(
L
,
Ltype
==
LUA_TFUNCTION
||
Ltype
==
LUA_TLIGHTFUNCTION
,
n
,
"invalid function"
);
luaL_argcheck
(
L
,
Ltype
==
LUA_TFUNCTION
||
Ltype
==
LUA_TLIGHTFUNCTION
,
n
,
"invalid function"
);
lua_pushvalue
(
L
,
n
);
lua_pushvalue
(
L
,
n
);
int
task_fn_ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
int
task_fn_ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
...
...
docs/en/modules/node.md
View file @
acddf29f
...
@@ -433,7 +433,7 @@ If the priority is omitted then this defaults to `node.task.MEDIUM_PRIORITY`
...
@@ -433,7 +433,7 @@ If the priority is omitted then this defaults to `node.task.MEDIUM_PRIORITY`
```
lua
```
lua
for
i
=
node
.
task
.
LOW_PRIORITY
,
node
.
task
.
HIGH_PRIORITY
do
for
i
=
node
.
task
.
LOW_PRIORITY
,
node
.
task
.
HIGH_PRIORITY
do
node
.
task
.
post
(
i
,
function
(
p2
)
node
.
task
.
post
(
i
,
function
(
p2
)
print
(
"priority is ..p2)
print
(
"priority is
"
..
p2
)
end
)
end
)
end
end
```
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment