-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaftools_lib.lua
More file actions
64 lines (51 loc) · 1.41 KB
/
Copy pathaftools_lib.lua
File metadata and controls
64 lines (51 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--[[
Arena Fighting equipment
Copyright (c) 2017 ralf Weinert <ralf.weinert@gmx.de>
Source Code:
License: GPLv2.1
]]--
-- some function for the aftools
-- save a table to file
function tablesave(fileName, ItemTable)
local file = io.open(minetest.get_worldpath().."/players/"..fileName, "w")
if file then
for ii, ItemName in ipairs(ItemTable) do
-- file:write(minetest.serialize(ItemName))
file:write("["..ii.."] - "..ItemName.." \n ")
end
file:close()
end
end
-- load remove item file
function loadRemoveItemFile()
local file = io.open(minetest.get_worldpath().."/RemoveItemFile.aftools", "r")
local returnTable = {}
if file then
local tableItem = file -- minetest.deserialize(file:read()) --"*all"))
--if tableItem then
-- table.insert(table, tableItem)
--end
repeat
local tableItem = file:read("*line")
if tableItem == nil then
break
end
if string.len(tableItem) > 1 then
table.insert(returnTable, tableItem)
end
until file:read(0) == nil
io.close(file)
end
return returnTable -- {}
end
function IsThereSomethingToRemove(playername)
local ItemTable = {}
ItemTable = loadRemoveItemFile()
local withIntro = 1
local withoutIntro = 0
print_log("List of Items in File",withIntro)
-- print ItemTable on Screen
for ii, ItemName in ipairs(ItemTable) do
print_log("["..ii.."] - "..ItemName,withoutIntro)
end
end