os.loadAPI

Globally loads a user created program as a table of functions, using the name of the file as the reference to put the table under.

ExampleLoading a user created API
Loads an API from a file called myAPI.lua in the base directory. All functions in the 'myAPI.lua' API will be accessible through the use of myAPI.<function name>
Code
isLoaded = os.loadAPI("/myAPI.lua")
if isLoaded then
  print("myAPI is ready to use!")
end
Output
myAPI is ready to use!

os.loadAPI
Function
Syntax
os.loadAPI(
  • path : string
)

Returns boolean
API os
Source CC:Tweaked
This function is deprecated. Use of this function will pollute the global table, use require instead.
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.