User Tools

Site Tools


doc:lua_make-your-own-scripts

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
doc:lua_make-your-own-scripts [2014/10/05 16:37] – [The IO Commands] admindoc:lua_make-your-own-scripts [2014/10/13 18:20] – [The IO Commands] admin
Line 169: Line 169:
  
 ==== The IO  Commands ==== ==== The IO  Commands ====
 +
  
 FIXME the whole IO command section is in pure experimental state. There's no guarantee that these functions are even exist, are implemented as described or not subject to change. FIXME the whole IO command section is in pure experimental state. There's no guarantee that these functions are even exist, are implemented as described or not subject to change.
Line 174: Line 175:
  
 OOBD uses its own scheme for file IO, mainly driven by the restriction of a remote user and the need of complex data buffer handling. OOBD uses its own scheme for file IO, mainly driven by the restriction of a remote user and the need of complex data buffer handling.
 +
  
 Similar to the LUA simple IO model, OOBD has always only just input and output file handle. As long as not redirected, these are stdin and stdout. Similar to the LUA simple IO model, OOBD has always only just input and output file handle. As long as not redirected, these are stdin and stdout.
 +
  
 As OOBD knows more as only one type of data sources, the parameter ''message'' is misused to control the behaviour. As OOBD knows more as only one type of data sources, the parameter ''message'' is misused to control the behaviour.
 +
  
 . .
- 
- 
  
  
 === ioInput(file name ,file_extension,message) === === ioInput(file name ,file_extension,message) ===
 +
  
 Tries to open the file accourding to the following parameter combinations: Tries to open the file accourding to the following parameter combinations:
  
  
 +^  filename  ^  message  ^  Effect  |  |
 +|/unix-path/.. |any message |Open a file Open dialog with preselected path (and file). At success returns the file path, otherwise null |  |
 +|/unix-path/.. |'direct' |Open the given file without Dialog, At success returns the file path, otherwise null |  |
 +|URL like ''HTTP:<nowiki>//</nowiki>''.. |'html' |Reads the URL as input.At  success returns the URL, otherwise null ||
 +|URL like ''HTTP:<nowiki>//</nowiki>''.. |a lua table |JSON-RFC call: If the parameter message is a lua table, it's translated into a JSON string and send as POST to the given URL. After evaluation, the server returns a JSON string converted into a lua table and returned by the function |  |
  
-^  filename  ^  message  ^  Effect  ^ 
-| /unix-path/.. | any message | Open a file Open dialog with preselected path (and file). At success returns the file path, otherwise null | 
-| /unix-path/.. | 'direct' | Open the given file without Dialog, At success returns the file path, otherwise null | 
-| URL like ''HTTP:<nowiki>//</nowiki>''.. | 'html' | Reads the URL as input.At  success returns the URL, otherwise null || 
-| URL like ''HTTP:<nowiki>//</nowiki>''.. | a lua table | JSON-RFC call: If the parameter message is a lua table, it's translated into a JSON string and send as POST to the given URL. After evaluation, the server returns a JSON string converted into a lua table and returned by the function | 
  
 +=== ioRead("%%*%%line") ===
  
  
 +Read one line of the input file ending with either %%\%%r%%\%%n or %%\%%n as string without the EOL. In case of input EOF or read errors the function returns nil
 +
 +
 +=== ioRead ("%%*%%all") ===
  
-=== ioRead("*line") === 
-Read one line of the input file ending with either \r\n or \n as string without the EOL. In case of input EOF or read errors the function returns nil 
  
-=== ioRead ("*all") === 
 Read the whole file as string Read the whole file as string
 +
  
 === ioRead (count) === === ioRead (count) ===
 +
 +
 Read count number of bytes as string Read count number of bytes as string
 +
  
 === ioOutput(URL[,append[,message]]) === === ioOutput(URL[,append[,message]]) ===
  
-Try to opens ''URL'' as output. A ''SCRIPT:<nowiki>//</nowiki>'' URL is readonly and so not allowed as output. If append is TRUE, the output is appended to an already existing file. If the given file path is empty or just a directory, a file dialog opens. If given, the message is used in the dialog as title 
  
 +Try to opens ''URL'' as output. A ''SCRIPT:<nowiki>//</nowiki>'' URL is readonly and so not allowed as output. If append is TRUE, the output is appended to an already existing file. If the given file path is empty or just a directory, a file dialog opens. If given, the message is used in the dialog as title
 === ioWrite (String) === === ioWrite (String) ===
 +
 +
 Attaches the string content to the output file Attaches the string content to the output file
  
 +
 +\\
  
 ====  Miscellaneous  Commands ==== ====  Miscellaneous  Commands ====
doc/lua_make-your-own-scripts.txt · Last modified: 2019/04/08 18:43 by admin