This tutorial will cover on how to make a real, useful API. But before making this api, make sure you have made Your first API and a Apiloader. If you allready have done those, let's make a Custom File API, which will simplify reading and writing files.

Let's get working. Open the folder "api" and create a file named "file"

-- Custom File API v. 1.0
-- Written by Brainless243
-- Posted to The Tekkit Wiki on 24/10/2012

function read(sFile, mode) -- sFile stands for the file to read, and the modes are: "r" for just reading one line, and "a" for reading all lines
local hRead = assert(, "r"))
 if mode == "r" then
  text = hRead.readLine()
  return text
 elseif mode == "a" then
  text = hRead.readAll()
  return text

function write(sFile, mode, input)  -- As before, sFile stands for the file to open, but the modes are diffrent. "w" is overwriting the existing document, "a" continues the document. Input is what to be written.
local hWrite = assert(, mode))
text = hWrite.write(input)
return text

And thats that. To call, for example, the read function, type

print("potato", "a"))

That will print whatever text is found in the file "potato".

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.