Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
api [2016/06/17 05:14]
payonel [Custom Libraries]
api [2016/06/17 05:43]
payonel adding list of standard libs in global
Line 7: Line 7:
 First and foremost you should get familiar with the [[http://​www.lua.org/​manual/​5.3/​manual.html|Lua reference manual]], if you are new to Lua. You will find most basic Lua functionality explained there, as well as a bunch of standard library functions. First and foremost you should get familiar with the [[http://​www.lua.org/​manual/​5.3/​manual.html|Lua reference manual]], if you are new to Lua. You will find most basic Lua functionality explained there, as well as a bunch of standard library functions.
  
-OpenComputers makes an effort to largely emulate the standard library in areas that would usually interact with the host system - that being the I/O library. There are a few differences,​ which you can look up here: [[api:​non-standard-lua-libs|differences in the standard libraries]]. Most notably, the debug library is mostly ​ unavailable,​ and `load` only accepts text source files, no binary / pre-compiled Lua programs (for security reasons).+OpenComputers makes an effort to largely emulate the standard library in areas that would usually interact with the host system - that being the I/O library. There are a few differences,​ which you can look up here: [[api:​non-standard-lua-libs|differences in the standard libraries]]. Most notably, the debug library is mostly unavailable,​ and `load` only accepts text source files, no binary / pre-compiled Lua programs (for security reasons). 
 + 
 +These standard libraries are available in the global environment and thus are immediately available; meaning they do not need to be loaded in your scripts to be accessible. 
 + 
 +  * [[api:​non-standard-lua-libs#​coroutine_manipulation|coroutine]] 
 +  * [[api:​non-standard-lua-libs#​debug|debug]] 
 +  * [[api:​non-standard-lua-libs#​input_and_output_facilities|io]] 
 +  * [[api:​non-standard-lua-libs#​mathematical_functions|math]] 
 +  * [[api:​non-standard-lua-libs#​operating_system_facilities|os]] 
 +  * [[api:​non-standard-lua-libs#​Modules|package]] 
 +  * `print` Not a library, but a commonly used standard method for printing text to stdout. 
 +```lua 
 +print("​hello world"​) 
 +``` 
 +  * [[api:​non-standard-lua-libs#​string_manipulation|string]] 
 +  * [[api:​non-standard-lua-libs#​table_manipulation|table]]
  
 Note that you now need to `require` all non-standard APIs (including the ones below) before you use them, i.e. all modules not listed in the [[http://​www.lua.org/​manual/​5.2/​manual.html|Lua reference manual]]. Note that you now need to `require` all non-standard APIs (including the ones below) before you use them, i.e. all modules not listed in the [[http://​www.lua.org/​manual/​5.2/​manual.html|Lua reference manual]].
Line 35: Line 50:
 - [[api:​fileSystem|FileSystem]]:​ abstracted interaction with file system components. - [[api:​fileSystem|FileSystem]]:​ abstracted interaction with file system components.
 - [[api:​internet|Internet]]:​ a wrapper for Internet Card functionality. - [[api:​internet|Internet]]:​ a wrapper for Internet Card functionality.
-- [[api:​non-standard-lua-libs#​input_and_output_facilities|IO]]:​ processing input and output of processes, based on the standard Lua library 
 - [[api:​keyboard|Keyboard]]:​ a table of key codes by name and pressed key tracking. - [[api:​keyboard|Keyboard]]:​ a table of key codes by name and pressed key tracking.
 - [[api:​note|Note]]:​ converts music notes between their real name, their MIDI code and their frequency - [[api:​note|Note]]:​ converts music notes between their real name, their MIDI code and their frequency
-- [[api:​non-standard-lua-libs#​operating_system_facilities|OS]]:​ general operating system api, based on the standard Lua library 
 - [[api:​package|Package]]:​ provides cached libraries and special loading. - [[api:​package|Package]]:​ provides cached libraries and special loading.
 - [[api:​process|Process]]:​ keeps track of running programs and their environments. - [[api:​process|Process]]:​ keeps track of running programs and their environments.