Commit ed85e21a authored by Tom Sutcliffe's avatar Tom Sutcliffe Committed by Johny Mattsson
Browse files

Allow LUA_INIT_STRING to be set in menuconfig

parent f592cf4e
...@@ -132,4 +132,35 @@ menu "Lua configuration" ...@@ -132,4 +132,35 @@ menu "Lua configuration"
select NODEMCU_CMODULE_UART select NODEMCU_CMODULE_UART
select LUA_BUILTIN_DEBUG select LUA_BUILTIN_DEBUG
choice LUA_INIT_STRING
prompt "Boot command"
default LUA_INIT_STRING_INIT_LUA
help
Command to run on boot. This can be a .lua file, an LFS module, or
any valid Lua expression. By default init.lua is loaded and run
from the SPIFFS filesystem.
config LUA_INIT_STRING_INIT_LUA
bool "init.lua from SPIFFS"
config LUA_INIT_STRING_INIT_LFS
bool "init module from LFS"
config LUA_INIT_STRING_CUSTOM
bool "Custom"
endchoice
config LUA_INIT_STRING_CUSTOM_STRING
string "Custom boot command" if LUA_INIT_STRING_CUSTOM
default ""
help
Run a custom command on boot.
Specify @filename.lua to load "filename.lua" from SPIFFS.
Specify node.LFS.get('foo')() to load the module "foo" from LFS.
Or specify any other valid Lua expression to execute that on boot.
config LUA_INIT_STRING
string
default "@init.lua" if LUA_INIT_STRING_INIT_LUA
default "node.LFS.get('init')()" if LUA_INIT_STRING_INIT_LFS
default LUA_INIT_STRING_CUSTOM_STRING if LUA_INIT_STRING_CUSTOM
endmenu endmenu
...@@ -30,11 +30,7 @@ ...@@ -30,11 +30,7 @@
#endif #endif
#ifndef LUA_INIT_STRING #ifndef LUA_INIT_STRING
# if defined(CONFIG_NODEMCU_EMBED_LFS) # define LUA_INIT_STRING CONFIG_LUA_INIT_STRING
# define LUA_INIT_STRING "node.LFS.get('init')()"
# else
# define LUA_INIT_STRING "@init.lua"
# endif
#endif #endif
#if !defined(STARTUP_COUNT) #if !defined(STARTUP_COUNT)
......
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