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 revision
Previous revision
doc:lua_make-your-own-scripts [2015/11/15 13:31] – [Miscellaneous Commands] admindoc:lua_make-your-own-scripts [2019/04/08 18:43] (current) – [The IO Commands] admin
Line 136: Line 136:
  
  
-==== The Communication  Commands ====+==== The Communication Commands ====
  
  
Line 192: Line 192:
  
  
-^  filename  ^  message  ^  Effect   | +^  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/.. |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  | +|/unix-path/.. |'direct' |Open the given file without Dialog, At success returns the file path, otherwise null  \\ actual either complete path are supported, relative paths or filenames only. Filenames and relative paths are relative to the actual script directory 
-|URL like ''HTTP:<nowiki>//</nowiki>''.. |'html' |Reads the URL as input.At  success returns the URL, 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 |  |+|URL like ''HTTP:<nowiki>//</nowiki>''.. or ''file:<nowiki>//</nowiki>''..|'json' |JSON-RFC call: The parameter ''file_extension'' can be a lua table or a JSON string, in case of a lua table, it's translated into a JSON string and send as POST to the given URL. In case of a file:<nowiki>//</nowiki>- URL, the local file is read as a JSON file |
  
 +
 +After opening the file with IOInput(), it can be read with ioRead()
  
 === ioRead("%%*%%line") === === 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 +Read one line of the input file ending with either<nowiki> \</nowiki>r<nowiki>\</nowiki>n or<nowiki> \</nowiki>n as string without the EOL. In case of input EOF or read errors the function returns nil. By this the whole file can be read line per line
- +
 === ioRead ("%%*%%all") === === ioRead ("%%*%%all") ===
  
Line 211: Line 211:
  
  
-=== ioRead (count) ===+=== ioRead ("%%*%%json") ===
  
  
-Read count number of bytes as string+Here it's assumed that the input file consists of a JSON string containing data. This string is translated into a lua table structure and returned
  
  
-=== ioOutput(URL[,append[,message]]) ===+=== ioRead ("%%*%%sha256") ===
  
  
-Try to opens ''URL'' as outputA ''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 +This mainly for testing purposesIt returns the sha256 checksum of that file
-=== ioWrite (String) ===+
  
  
-Attaches the string content to the output file+\\
  
 +==== The Buffer Commands ====
 +
 +
 +FIXME this whole Buffer section is not implemented and actual just here as a reference for discussion
  
  
Line 302: Line 305:
  
  
-==== Miscellaneous  Commands ====+==== WriteString Command Syntax ====
  
 +As default the command 
  
-=== serDisplayWrite(String) ===+  serDisplayWrite(String) 
 + 
 + 
 +writes //String// to the build in output console. But with an optional secound parameter as command this behavior can be changed: 
 + 
 +  serDisplayWrite(parameter, command) 
 + 
 +The different commands have the following effects: 
 + 
 +^ parameter  ^ command  ^ Function 
 +| buffername  | setbuffer  | redirects the following DisplayWrite()'s output into buffer "bufferName". If the buffer does not exists, it's automatically generated \\ The default output window buffername, which is also active at start, is //display// To write some output there after using some other buffers before, set buffer back to //display// | 
 +| -           | clear      | clears actual buffer content | 
 +| -           | clearall   | clears all buffers. Senseful at start of scripts, if wanted, as the buffers contain their contents between scripts runs | 
 +| filename    | save       | saves actual buffer to filename without further asking 
 +| filename    | saveas       | saves actual buffer to filename by let the user first confirm the filename 
 +| filename    | append       | appends actual buffer to filename without further asking 
 +| filename    | appendas       | appends actual buffer to filename by let the user first confirm the filename 
 + 
 + 
 + 
 + 
 +==== Miscellaneous  Commands ====
  
  
-Writes //String// to the build in output console. 
 === dbLookup(db-File , searchstring) === === dbLookup(db-File , searchstring) ===
  
doc/lua_make-your-own-scripts.1447590688.txt.gz · Last modified: 2015/11/15 13:31 by admin