English os.remove

7 replies
Goto Page
To the start Previous 1 Next To the start
03.10.13 01:51:19 am
Up
pbeloto
User
Offline Off
help-me command os.remove.

it works only of time in when .

can anyone help me??

Code:
1
2
3
4
5
6
if cmd== "@remove_admin" then
     if usgn > 0 then
          os.remove("sys/lua/user/"..usgn..".txt")
     end
return 1
end
03.10.13 08:15:39 am
Up
MikuAuahDark
User
Offline Off
Try assertion

Code:
1
assert(os.remove("sys/lua/user/"..usgn..".txt"))


And make sure that usgn variable is exist
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
03.10.13 04:22:39 pm
Up
pbeloto
User
Offline Off
user MikuAuahDark has written:
Try assertion

Code:
1
assert(os.remove("sys/lua/user/"..usgn..".txt"))


And make sure that usgn variable is exist



Error

Code:
1
LUA ERROR: sys/lua/TCM/script.lua:560: sys/lua/TCM/Users/Admin/3323.txt: Permission denied
04.10.13 05:48:13 am
Up
MikuAuahDark
User
Offline Off
something wrong with the file. Because it shows "Permission Denied". Make sure that the file is closed before deleting
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
04.10.13 01:09:04 pm
Up
DannyDeth
User
Offline Off
If CS2D is running from 'Program Files' in Windows, this can happen because CS2D does not have permission to modify things.
04.10.13 05:47:39 pm
Up
pbeloto
User
Offline Off
user MikuAuahDark has written:
something wrong with the file. Because it shows "Permission Denied". Make sure that the file is closed before deleting



you have skype for help-me?
04.10.13 11:21:01 pm
Up
MikuAuahDark
User
Offline Off
Sorry, i don't have Skype. Well about your problem, try to inversigate all function that uses io.open function and check if it's really closed.

You may also try to collectgarbage first then removing it if you cannot find which function is causing the problem.

Add this code above os.remove
Code:
1
collectgarbage("collect")


So, the re-builded code is should like this
Code:
1
2
3
4
5
6
7
if cmd== "@remove_admin" then
     if usgn > 0 then
          collectgarbage("collect")
          assert(os.remove("sys/lua/user/"..usgn..".txt"))
     end
     return 1
end


If you still getting "Permission Denied!" then CS2D doesn't have rights to delete that file, file permissions doesn't set correctly, or both.
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
05.10.13 12:56:57 am
Up
pbeloto
User
Offline Off
Thanks you '-'

Admin/mod comment:

Senseless quote removed. Read thread us Pointless Quote Offensive /user useigor
To the start Previous 1 Next To the start