How do I create a LUA module?
  • Moderator
    Kronos
    Posts: 1881 from 2003/2/24
    O.k. here is what I've tried sofar:

    - took the source for os.module and replaced all "os" with "test"
    - added "t_" in front of all function-names

    -> compiled without issues

    - copied to "ibs:lua/" (also tried" mossys.libs/lua")

    1st line of script: " require 'test'"

    ->
    Code:
    lua: Work:module_test/test.lua:1: module 'test' not found:
    no field package.preload['test']
    no file '/usr/local/share/lua/5.3/test.lua'
    no file '/usr/local/share/lua/5.3/test/init.lua'
    no file '/usr/local/lib/lua/5.3/test.lua'
    no file '/usr/local/lib/lua/5.3/test/init.lua'
    no file './test.lua'
    no file './test/init.lua'
    no file '/usr/local/lib/lua/5.3/test.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './test.so'
    stack traceback:
    [C]: in function 'require'
    Work:module_test/test.lua:1: in main chunk
    [C]: in ?


    Seems that LUA only knows a fixed number of modules listed in "package".

    LUA docs itself want me to either do a .dll (would that work???) or compile my own LUA with my module linked to it (not really an option).
    --------------------- May the 4th be with you ------------------
    Mother Russia dance of the Zar, don't you know how lucky you are
  • »20.06.19 - 18:46
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    polluks
    Posts: 432 from 2007/10/23
    From: Gelsenkirchen,...
    Hmm, this is the output of Lua not LuaX...
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.11
  • »20.06.19 - 19:33
    Profile
  • Moderator
    Kronos
    Posts: 1881 from 2003/2/24
    *facepalm*

    So that actually works.....


    Thats for always starting LUA-scripts from inside a C-App


    *facepalm*
    --------------------- May the 4th be with you ------------------
    Mother Russia dance of the Zar, don't you know how lucky you are
  • »20.06.19 - 19:39
    Profile