Posted 25 July 2018 - 09:14 PM
small api to load in file into a table
https://pastebin.com/PRy6wHcs
functions:
loadFiles(table,path1,path2,path3,etc) will load in the files to the table
structure:
table will contain other tables accessible via a number those table will contain the following:
each line in the file accessible for by a number content,which is a field containing the whole file
Examples:
table[1][2] will access the second line on the first file
table[3]["content"] will access the whole third file
readFile(path,table) will load a single file into the table
structure:
each line in the file accessible for by a number content,which is a field containing the whole file
Examples:
table[2] will access the second line on the first file
table["content"] will access the whole third file
do note that the api will NO clear the table before writing
have fun with the api,while you are not obligated to credit me in the api or in a project where said api is used,please do not claim you wrote this api
faq:
q:the table is all messed up
a:you probably didint clear it before running the api again
q:i get file2table.lua:4: attempt to index ? (a nil value)
a:you supplied an invalid path
https://pastebin.com/PRy6wHcs
functions:
loadFiles(table,path1,path2,path3,etc) will load in the files to the table
structure:
table will contain other tables accessible via a number those table will contain the following:
each line in the file accessible for by a number content,which is a field containing the whole file
Examples:
table[1][2] will access the second line on the first file
table[3]["content"] will access the whole third file
readFile(path,table) will load a single file into the table
structure:
each line in the file accessible for by a number content,which is a field containing the whole file
Examples:
table[2] will access the second line on the first file
table["content"] will access the whole third file
do note that the api will NO clear the table before writing
have fun with the api,while you are not obligated to credit me in the api or in a project where said api is used,please do not claim you wrote this api
faq:
q:the table is all messed up
a:you probably didint clear it before running the api again
q:i get file2table.lua:4: attempt to index ? (a nil value)
a:you supplied an invalid path
Edited on 25 July 2018 - 07:24 PM