Trying to include a file which exists.

Alright, basically I’m converting an addon to Nutscript plugin, though it’s main problem is including on clientside the apps for the phone…

Serverside AddCSLua() - tried print() here as well, it adds correctly.
[lua]
– Apps
local files = file.Find( engine.ActiveGamemode()…"/plugins/cellphone/apps/*.lua", “LUA”)
for k, v in pairs(files) do
AddCSLuaFile(“apps/”…v)
end
[/lua]

ClientSide include in seperate file, but same folder as the AddCSLua serverside file.
[lua]
function gPhone.importApps()
gPhone.msgC( GPHONE_MSGC_NONE, “Importing applications…” )
local files = file.Find( engine.ActiveGamemode()…"/plugins/cellphone/apps/*.lua", “LUA”)

gPhone.log("Found "..#files.." app files to be loaded")

if #files == 0 then
	gPhone.msgC(GPHONE_MSGC_WARNING, "No apps were able to be loaded!! Dumping debug log")
	gPhone.dumpLog()
	return
end

print("Files:")
PrintTable(files)

for k, v in pairs(files) do
	print("+ apps/" .. v)
	include("apps/"..v)
end

gPhone.setActiveApp( nil ) 

end
[/lua]

Output. How come it finds the files on the clientside, puts it in table. But the include doesn’t work? This doesn’t make any sense.



Files:
1	=	2dsidescroller.lua
2	=	_example.lua
3	=	browser.lua
4	=	camera.lua
5	=	contacts.lua
6	=	finances.lua
7	=	flappy.lua
8	=	jobs.lua
9	=	music.lua
10	=	notes.lua
11	=	phone.lua
12	=	pong.lua
13	=	settings.lua
14	=	store.lua
15	=	text.lua
+ apps/2dsidescroller.lua
Couldn't include file 'apps\2dsidescroller.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/_example.lua
Couldn't include file 'apps\_example.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/browser.lua
Couldn't include file 'apps\browser.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/camera.lua
Couldn't include file 'apps\camera.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/contacts.lua
Couldn't include file 'apps\contacts.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/finances.lua
Couldn't include file 'apps\finances.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/flappy.lua
Couldn't include file 'apps\flappy.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/jobs.lua
Couldn't include file 'apps\jobs.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/music.lua
Couldn't include file 'apps\music.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/notes.lua
Couldn't include file 'apps
otes.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/phone.lua
Couldn't include file 'apps\phone.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/pong.lua
Couldn't include file 'apps\pong.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/settings.lua
Couldn't include file 'apps\settings.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/store.lua
Couldn't include file 'apps\store.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))
+ apps/text.lua
Couldn't include file 'apps	ext.lua' (File not found) (@gamemodes/bmrp/plugins/cellphone/cl_appbase.lua (line 84))


You’re only including from apps/file.lua instead of yourgamemode/plugins/cellphone/apps/file.lua

[editline]28th May 2015[/editline]

Oops, realised you are calling the include from a file in the cellphone directory, it should be working…

include() is relative from the folder the file it’s put in.

So if I have cl_appbase.lua inslude gamemodes/bmrp/plugins/cellphone/cl_appbase.lua, and do include(“apps/app.lua”) then the path is: “gamemodes/bmrp/plugins/cellphone/(apps/app.lua)”

Edit: As you said yeah.

I’ve been getting this too. I’ve tried AddCSLuaFile()/include()'ing files from different sources, still no luck :frowning: