Calling LUA function from C, help!
Posted: Wed Jun 10, 2015 6:30 am
I am re-compiling the NodeMCU LUA successfully as I am trying to package several LUA calls together and mix them with C API calls. Has anybody tried to call a NodeMCU LUA function like wifi.ap.getmac from C? Again, I am trying to mix C and LUA and the stuff compiles fine but it makes the module crash and go into a loop here is an example of the code I'm using:
void get_mac_add( lua_State* L)
{
lua_State* L;
lua_getglobal(L, "wifi.ap.getmac");
lua_pcall(L, 0, 1, 0);
const char * macadd = lua_tostring(L, -1);
INFO(macadd); // macro to print to UART
}
Any help will be much appreciated.
Thanks
Horacio.
void get_mac_add( lua_State* L)
{
lua_State* L;
lua_getglobal(L, "wifi.ap.getmac");
lua_pcall(L, 0, 1, 0);
const char * macadd = lua_tostring(L, -1);
INFO(macadd); // macro to print to UART
}
Any help will be much appreciated.
Thanks
Horacio.