lua-users home
lua-l archive

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

Hello there !
First, my apologies for this noob question.

I've just started to use LUA, but so far I had no trouble creating .lua file, loading lua file in C/C++ and calling C/C++ functions from a .lua file as well as calling functions from a .lua file in C/C++.

However, my .lua file is going to be a little too big for me, and to keep things clean, I would like to split it up in two or more .lua files.

So, obviously, I want to have some functions in "a.lua" and "b.lua" and to be able to call them from "main.lua", which is the file I load in my C/C++ program.

In order to do that, I tried to move a function from my "main.lua" to "a.lua", and to add either :

  require "a"
or ...

... in "main.lua". Also, in "a.lua", I tried to add :
  module(..., package.seeall);

But the result is always the same : when I run "main.lua" in my C/C++ program, it doesn't load.
As soon as I remove the "require" or "dofile" line, the file loads well.

Thus, I suppose I am missing a very important point.

Is it possible to achieve what I'am trying to do ?
Or perhaps should I make a C/C++ function which will be called to load the "a.lua" and "b.lua" ? Or is it supposed to work like that and I only have a directory path problem ?

Thanks for your help :o)

François-Xavier INGLESE

Laboratoire d'Ingénierie des Systèmes Automatisés,
62, Avenue Notre Dame du Lac - 49000 Angers
Tél. (33). - Fax : (33).