Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexing a function restarts the ESP instead of reporting an error #3141

Closed
TerryE opened this issue Jun 2, 2020 · 2 comments
Closed

Indexing a function restarts the ESP instead of reporting an error #3141

TerryE opened this issue Jun 2, 2020 · 2 comments
Assignees

Comments

@TerryE
Copy link
Collaborator

TerryE commented Jun 2, 2020

Expected behaviour

Typing return require[1] one standard Lua (on a PC) generates an error:

> return require[1]
stdin:1: attempt to index global 'require' (a function value)
stack traceback:
	stdin:1: in main chunk
	[C]: ?
> 

NodeMCU Lua on the ESP should do the same.

Actual behaviour

> return require[1]

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)
 ...
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
	branch: dev
	commit: 8f85c9b3e4a606f1731051af45c39302799ddb28
	release: 
	release DTS: 202005281716
	SSL: false
	build type: float
	LFS: 0x20000 bytes total capacity
	modules: encoder,file,gdbstub,gpio,net,node,sjson,tmr,uart,wifi
 build 2020-05-29 13:01 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
> return node.bootreason()
2	2	28	1073790848	0	0	100	0
>  return '0x%x' % 10737908 48
0x4000bf80
> -- This is a S/W exception in the bootROM at 0xbf80 "A load referenced a page mapped with an attribute that does not permit loads"

Test code and NodeMCU startup banner

See above

Hardware

Wemos D1 mini

@TerryE TerryE added the bug label Jun 2, 2020
@TerryE TerryE self-assigned this Jun 2, 2020
@TerryE TerryE added the Lua 5.1 label Jun 9, 2020
@TerryE
Copy link
Collaborator Author

TerryE commented Jun 9, 2020

I've checked LUA=53 and both luac.cross variants. This only occurs in the Lua51 environment for ESP firmware builds. It's one-liner introduced when I collapsed the two function types but didn't change a ttype(o) to basettype(o). I will roll this into my errors PR.

@TerryE
Copy link
Collaborator Author

TerryE commented Jun 14, 2020

Fixed in #3163

@TerryE TerryE closed this as completed Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant