lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Oct 3, 2012 9:14 AM, "David Collier" <myshkin@cix.co.uk> wrote:
>
>
>
> > *From:* "steve donovan" <steve.j.donovan@gmail.com>
> > *To:* <myshkin@cix.co.uk>, "Lua mailing list" <lua-l@lists.lua.org>
> > *Date:* Wed, 3 Oct 2012 14:22:10 +0200
> >
> > On Wed, Oct 3, 2012 at 2:14 PM, David Collier <myshkin@cix.co.uk>
> > wrote:
> > > maybe what we actually need is a "bytecode linker" that can
> > > include/exclude sections of bytecode before installation :-)
> >
> > Possible, but so much easier to do in Lua code....
> >
> > Curiously enough, I haven't done a classic #ifdef macro in LuaMacro,
> > but it's very do-able. It will look pretty much like the C
> > preprocessor, however, unless someone can think of a higher-level
> > construct.
>
> won't # if fred == nil then
>
> fulfil the purpose?
>
> > The trouble with preprocessing Lua is that matching compile and
> > run-time errors up later isn't easy. So with LuaMacro (for instance)
> > the code is launched from LM and the line numbers of any errors are
> > patched for sensible output.  Thereafter it can of course generate
> > standalone Lua files.
>
> At the moment I'm creating .luam files and generating .lua ones from them
> then running them manually
> I had enough trouble working out how to get eclipse to do that for me :-)
> A pre-process->run link is beyond me at this moment.
>
> > Also, are the code and strings for debugging purposes so very large
> > that it affects Lua load time and performance?  Premature
> > optimization is an easy thing to get lost in...
>
> Indeed - I am thinking ahead to trying to get a worthwhile size of
> program inside a single-chip-micro
>
>
> >
> > steve d.
> >
>

I think my solution would be to put the functions you want into a module, and make two different versions of the module - one for the PC and one for the chip, the latter containing just a dummy stub function. Then you just need to copy the correct set of modules to the chip. It's not perfect (still two copies) but it'd work if all you want to do is skip/disable certain functions.