lua-users home
lua-l archive

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


Hi

I would like to compile the following "project"

Project directory: prj01.

The dir contains:

the main file of the project - program.lua
---
M1 = require "module1"
M2 = require "module2"

M1.function1 ()
M2.function2 ()
---

module file 1 - module1.lua
---
local module = {}

module.function1 = function ()
  
print ("module.function1" )
end

return module
---

module file 2 - module2.lua
---
local module = {}

module.function2 = function ()
  
print ("module.function2" )
end
return m
odule
---


I have tried something like this:

luac -o ../program.luac program.lua module1.lua module2.lua
cd ..
lua program.luac

lua: program.lua:1: module 'module1' not found:
    no field package.preload['module1']
    no file './module1.lua'
    no file '/usr/share/lua/5.1/module1.lua'
    no file '/usr/share/lua/5.1/module1/init.lua'
    no file '/usr/lib/lua/5.1/module1.lua'
    no file '/usr/lib/lua/5.1/module1/init.lua'
    no file './module1.so'
    no file '/usr/lib/lua/5.1/module1.so'
    no file '/usr/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'require'
    program.lua:1: in main chunk
    (luac): in main chunk
    [C]: ?


but it does not work.

Can I merge all the source files into one output file?


--
Karol Drożak