-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiofiles.lua
More file actions
39 lines (27 loc) · 832 Bytes
/
Copy pathiofiles.lua
File metadata and controls
39 lines (27 loc) · 832 Bytes
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
-- File Path format: ../../../
-- File Name format: name.extension (txt, sav, etc.)
-- // LUA // --
function loadFile( filePath, fileName )
local s = {}
local file = io.open(filePath..fileName, "r")
local line = file:read("*l")
while line ~= nil do
s[#s + 1] = line
line = file:read("*l")
end
file.close(file)
return s
end
function writeFile( filePath, fileName, text )
local file = io.open(filePath..fileName, 'w')
file:write(text)
file:close()
end
-- // LÖVE2D //--
function saveTable( filePath, fileName, theTable, tableName )
return = love.filesystem.write( filePath..fileName, table.show(theTable, tableName)
end
function getTable( filePath, fileName )
theTable = love.filesystem.load( filePath..fileName )
return theTable
end