Include dont work in function ? [ GIFT FOR THE ONE THAT HELP ME ]
2 replies, posted
Hi everyone im new here and my mother tongue is french so my English isn't that good ^^
After wasting nearly 2 hours to figure out that AddCSLuaFile only work in shared i got another problem i just hope there is a solution to solve this
Finally work in a test code :
Shared.lua :
AddCSLuaFile("apps/hello.lua")
if CLIENT then
print("Client code loaded")
include("apps/hello.lua")
end
apps/hello.lua :
print("Hello World!")
Output :
CL : Client code loaded
Hello World!
but when i put a function it don't work anymore
AddCSLuaFile("apps/hello.lua")
if CLIENT then
print("Client code loaded")
function test()
include("apps/hello.lua")
end
test()
end
Now it return :
Couldn't include file 'apps\hello.lua' (File not found)
I will give away my F4 Tablet ( DarkRp ) as reward for the one who would help me out
( When i finish it up )
AddCSLuaFile works from serverside only (it does nothing on clientside), include - read the description: if you will try to call this function from another folder, where your apps/hello.lua doesn't exist, then it will try to include the file in lua/apps/hello.lua.
Thanks alot i though include path is defined from the script actual path but it's not it always check in the /lua/ folder thanks alot
Sorry, you need to Log In to post a reply to this thread.