You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifnotresourcenamethen-- if the player didn't specify the resource he wants to check, use current resource
7
8
resourcename=getResourceName(resource) --every resource has a predefined global variable called resource that contains the resource pointer for that resource, in other words, the value that getThisResource() function returns.
8
9
else
@@ -11,12 +12,13 @@ function checkExistingFile(player,cmd,filename,resourcename)
11
12
returnfalse-- stop the function here
12
13
end
13
14
end
15
+
14
16
-- as it hasn't stopped anywhere, we have both correct resourcename and filename
15
17
localexists=fileExists((":%s/%s"):format(resourcename,filename)) -- using shorter format of string.format, see StringLibraryTutorial in lua wiki for that
16
18
ifexiststhen
17
-
outputChatBox(("The file %q in resource %q exists"):format(filename,resourcename))
19
+
outputChatBox(("The file %q in resource %q exists"):format(filename,resourcename), player)
18
20
else
19
-
outputChatBox(("The file %q in resource %q doesn't exist"):format(filename,resourcename))
21
+
outputChatBox(("The file %q in resource %q doesn't exist"):format(filename,resourcename), player)
if (notresourcename) then-- if the player didn't specify the resource he wants to check, use current resource
7
8
resourcename=resource.name--every resource has a predefined global variable called resource that contains the resource pointer for that resource, in other words, the value that getThisResource() function returns.
8
9
else
@@ -11,12 +12,13 @@ function checkExistingFile(player,cmd,filename,resourcename)
11
12
returnfalse-- stop the function here
12
13
end
13
14
end
15
+
14
16
-- as it hasn't stopped anywhere, we have both correct resourcename and filename
15
17
localexists=File.exists((":%s/%s"):format(resourcename,filename)) -- using shorter format of string.format, see StringLibraryTutorial in lua wiki for that
16
18
if (exists) then
17
-
outputChatBox(("The file %q in resource %q exists"):format(filename,resourcename))
19
+
player:outputChat(("The file %q in resource %q exists"):format(filename,resourcename))
18
20
else
19
-
outputChatBox(("The file %q in resource %q doesn't exist"):format(filename,resourcename))
21
+
player:outputChat(("The file %q in resource %q doesn't exist"):format(filename,resourcename))
0 commit comments