Lua needs a relative path

I cannot load a .Lua file from a relative path.

This works:

2.lua

function Math( v1, v2 )
return v1 + v2
end

1.lua

< pre>package.path = package.path ..’;C:/Users/Lukas/Desktop/lua/function/?.lua’
require(“2”)
print(Math(1, 6))

This does not work:

package.path = package.path ..'./function/?.lua;'
require("2")
print(Math(1,6))

Can’t find a solution to my problem.

you missed it; separate the new path from the old path:

package.path = package .path ..';./function/?.lua;'

Require may show you this message:

no file'./ 2.lua./function/2.lua'

Should remind you of this problem.

I cannot load .Lua files from relative paths. < p>

This works:

2.lua

function Math( v1, v2 )
return v1 + v2
end

1.lua

package.path = package.path ..';C:/Users/Lukas/Desktop/ lua/function/?.lua'
require("2")
print(Math(1,6))

This does not work:

package.path = package.path ..'./function/?.lua;'
require(" 2")
print(Math(1,6))

Can’t find a solution to my problem.

You Missed it; separate the new path from the old path:

package.path = package.path ..';./function/?.lua;'

pre>

require may show you this message:

no file'./2.lua./function/2.lua'

You should be reminded of this problem.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3238 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.