Jump to content
Sign in to follow this  

Lua question: require with own lua-scripts fails

Recommended Posts

So far I have always Lua scripts included with dofile() in other scripts. That works, like expected.

Because loading files with "require" is more flexible, i've tried to do that with my scripts. I've added in the Lua startup script my pathes to package.cpath.

I'm using the property "Lua.User.Scripts.Path" and so i've added: 

props["Lua.User.Scripts.Path"].."?.lua;" and


So it works for "..test.lua" and also for "..testtest.lua" - pathes.

I've a simple script for testing:

file: test.lua

writeA = function()
    print( 'A' )

writeB = function()
    print( 'B' )
If i use: dofile(path_testfile) in another script, i've access to this functions.
By using: require "test", i get an error:


error loading module 'test' from file 'C:Code_AutoItLUAtest.lua':

%1 is not a valid Win32 application.


If i use require with the file "alien.lua" it works. But i can't see basicly differences in structure between the scripts. 
What am I doing wrong?
Thanks in advance.

Best Regards BugFix  

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...