Embedded Lua for C Apps

Addi2438
Posts: 13
Joined: Thu Sep 14, 2017 11:23 am

Embedded Lua for C Apps

Postby Addi2438 » Thu Sep 14, 2017 11:39 am

Morning everyone,

I'm trying to write a C application for the ESP32 that allows the user to write apps for it.
Imagine it like a gameboy where the user can write games for it by himself without having any knowledge in C or the hardware itself.

Because I dont want to write a whole new programming language I thougth Lua or Python migth be a great solution.

Is there any Lua or Python interpreter for the esp that I can integrate in my C code?

I know there are things like Lua-RTOS, nodeMCU etc. but it seems like I cant integrate them into my C code cause they are standalone solutions.

Thanks in advance :)

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Embedded Lua for C Apps

Postby kolban » Thu Sep 14, 2017 3:50 pm

Unfortunately, I can't speak to Lua or Python, but for your consideration (even if it is just for elimination), I have had good luck working in a JavaScript mixed mode. In that environment I can mix C and JavaScript quite freely. The engine I have been using is "Duktape".
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: Embedded Lua for C Apps

Postby martinayotte » Thu Sep 14, 2017 7:44 pm

There is Python implementation on ESP32 :
https://esp32.com/viewtopic.php?f=17&t= ... 083#p14083

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Embedded Lua for C Apps

Postby loboris » Thu Sep 14, 2017 8:24 pm

MicroPython could be quite easily integrated into C application, how it should be done depends on your needs.
Should the user write the 'application' on PC and transfer it to the device, or write the app on the device itself. Both could be done.
The implementation will add some 300K ~ 500K to the code size.

Addi2438
Posts: 13
Joined: Thu Sep 14, 2017 11:23 am

Re: Embedded Lua for C Apps

Postby Addi2438 » Thu Sep 14, 2017 10:07 pm

Good evening/morning

Thanks for your answers
I will check everything out tomorrow.

The user should be able to write a script on a pc put it on a sd card and load that script via a grapical menu.

At the moment I'm writing drivers for display, touch panel, ble etc.
I need to be able to include those too.

Who is online

Users browsing this forum: Google [Bot] and 97 guests