lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Igor Trevisan
> Sent: woensdag 30 april 2014 8:58
> To: lua-l@lists.lua.org
> Subject: How to load more than a file from C
> 
> Hi all,
> 
> I'm a Lua newbie and this is my first email to the list.
> I'm working wiht Lua into and embedded system where the main
> application is written in C and Lua is used to configure part
> of the system activities.
> I'm currently alble to load and execute a Lua script, loading it
> from a USB stick.
> What I'm now trying to do is execute a Lua function that uses an
> external module I wrote.
> So I have to load more than a single Lua file.
> I know that I could compile file_1.lua, file_2.lua, ..., file_n.lua
> and meld them in a  single bytecode but, just as an experiment,
> I would like to work with different lua files (text format, no bytecode).
> Is there a way to load and execute from my C program a Lua
> fuction which is "distributed" in more than a Lua text file?
> Without melding the files in a single bytecode?
> I hope I was clear enough (if I wasn't please, tell me and I'll ry to
> explain again and better!) and that somebody out there can give me
> some suggestions.
> Thanks a lot in advance,
> Igor.
> 

From your description it seems that you "run files" and not specifically Lua code or functions. Especially your wording "meld them in a single bytecode". 
Once you've created a Lua state you can load any file into it you want. And though I don't understand exactly what and how you're trying to do it, I think you should work this out on the Lua side.

Thijs