Hello all.
I am yet another one here who can’t figure out how to get a dev environment working for Lua.
Excluding vscode for now, I started basic. I installed Lua for Windows:
Perfect. All is well. I downloaded the ST libs and extracted them to C:\lualibs\lua_libs-api_v9. So far so good.
I set my LUA_PATH to C:\lualibs\lua_libs-api_v9?.lua;C:\lualibs\lua_libs-api_v9?\init.lua;.?\init.lua; as this is what the getting-started pages told me to do. Looks good to me.
I type in “lua” to enter the lua console. I can issue various commands. I try a few print commands and they work. Ok, good.
I look at the very first line of hello-world\src\init.lua file. It says this:
local capabilities = require “st.capabilities”
So I type this in, and I get this:
> local capabilities = require “st.capabilities”
error loading module ‘st.utils’ from file ‘C:\lualibs\lua_libs-api_v9\st\utils.lua’:
C:\lualibs\lua_libs-api_v9\st\utils.lua:684: ‘)’ expected near ‘&’
stack traceback:
[C]: ?
[C]: in function ‘require’
C:\lualibs\lua_libs-api_v9\st\capabilities\init.lua:14: in main chunk
[C]: in function ‘require’
stdin:1: in main chunk
[C]: ?
Ok, so what very basic everybody-knows-this-except-for-you-so-nobody-mentions-it thing am I missing here? It seems the LUA_PATH is being respected to some degree. Are there other libraries I need to load? If I remove the functions/offending lines in utils.lua that it references, I can get it to work and load and at least get past that line.
UPDATE: While my problem above still remains, after struggling with the array of kinda-sorta documented vscode/extension settings, I am able to get past that line of code in Visual Studio Code when I step through and debug. I had to add:
{
“lua.debug.settings.path”: “C:\lualibs\lua_libs-api_v9\?.lua;C:\lualibs\lua_libs-api_v9\?\init.lua;.\?\init.lua;”
}
to my .vscode/settings.json file. Who knew.
Anyway, it occurred to me that perhaps a SmartThings Edge driver isn’t MEANT to be run/executed locally. Maybe I made the incorrect assumption that I should be able to run and debug and step through my code (minus Zwave and Zigbee, of course). If this is the case, what do developers typically do during their iterative coding/debugging/testing iterative process? Is there some sort of remote debugging bridge available to debug through the hub in real time? Is there a less painful way than always deploying driver code via the ST CLI every single time?
Thanks!