[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Execution of pre compiled lua code from memory mapped files
- From: Tim Hill <drtimhill@...>
- Date: Thu, 28 May 2015 17:34:10 -0700
> On May 28, 2015, at 2:42 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> 2015-05-28 11:21 GMT+02:00 Hans Riekehof <Riekehof@schoeps.de>:
>
>> My idea is to have this for pre compiled lua code because I want to
>> write a lot of code in Lua and not in C/C++.
>
> Lua compiles to bytecode for a virtual machine. That VM is different
> for every major Lua release: 5.1, 5.2, 5.3 etc, but the same within minor
> releases 5.2.1, 5.2.2 etc. However, it is not supposed to portable across
> different architectures.
>
> I'm not entirely sure I understand what you want. Can you show us
> what the Lua code would look like in a postulated Lua dialect that has
> this feature?
>
The poster wants to execute directly from a bytecode file via memory-mapping to save on RAM footprint by avoiding the need to copy/load the bytecode into memory before execution. The issue of portability isn't a problem here since (presumably) the bytecode and Lua interpreter are all embedded in the flash/ROM image at the same time.
Given that Lua is designed for embedded systems it’s a bit surprising that this isn’t part of the core API.
—Tim