Hi
How are you guys organizing your code into manageable parts like modules? With a filesystem, we can use Lua modules, which provide dynamic loading, but also encapsulation and and related API definitions that we can 'require'. Is there a neat trick to allow some module/require-mechanism for a bare-metal system without any filesystem? Background: to get my feet wet with eLua, I implemented a simple generic "big loop" into which handlers for all sorts of tasks can be plugged, like event-handling, signaling, or non-blocking timing, allowing to realize what I call agents that (logically) execute independently and concurrently.*) This basic run-time infrastructure I don't need to touch (unless I detect errors... :-), so I would like to put it into a separate module. I did this using a Lua module, which I can dynamically load from the /rom or /mmc of my LS3S board. But what would I do if there's no filesystem?! Thanks! Cheers -- Stefan *) For example, the "dining philosophers" are each represented by one agent instance, instantiated from the same agent (type) code, and executed by my small run-time (yes, they all get to eat! :-). Plus there's an agent for the control of the board, like display dimming. You get the idea. _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
On Jun 23, 2010, at 7:18 AM, Stefan Brantschen wrote:
Couldn't you keep a list of "active" packages in a table (and a separate list of "inactive but available" packages)? The executive code would call functions from only the "active" packages as needed to deliver events, etc. Presumably all of the available packages would be compiled at the same time and would live in flash as one big blob. They could all start in the "active" list; initialization code in each could be called to do the initial activation/deactivation (perhaps as simply as using a "require" mechanism that increments a use count in the package).
There's an interesting discussion of using setfenv() and tables to manage package namespaces in chapter 15 of Programming in Lua . Ned Konz _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Free forum by Nabble | Edit this page |