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/13 18:22] admindoc:lua_make-your-own-scripts [2014/10/13 18:46] admin
Line 186: Line 186:
  
  
-=== ioInput(file name ,file_extension,message) ===+=== ioInput(file_name ,file_extension,message) ===
  
  
Line 228: Line 228:
  
  
-==== loadbuffer ==== +=== loadbuffer === 
-  loadbuffer(start: longint; VAR filelen: longint;  VAR filename: String; VAR err: integer)+  len, newfilename= loadbuffer(start filelen , file_name , file_extension , message)
  
-Reads the file "filename" into the telegram buffer starting at position "start" by reading "filelen" number of bytes+Reads the file "file_name" into the telegram buffer starting at position "start" by reading "filelen" number of bytes.
  
-The number of bytes read will be returned in "len".+The data source can be defined as explained for the ioInput command. 
 + 
 +The number of bytes read will be returned in "len", a negative value means a load error
  
 The following conditions apply: The following conditions apply:
-  * If the filename is "" (empty), then a file selection window will be opened, from which a file can be selected. The selected filename will be returned in "filename"+  * The selected filename will be returned in "filename"
-  * If len is 0, the whole file will be read. If the length exceeds the telegram length, an error will be raised.+  * If filename is 0, the whole file will be read. If the length exceeds the telegram length, an error will be raised.
  
  
  
  
-==== savebuffer ==== +=== savebuffer === 
-  savebuffer(start: longint; VAR filelen: longint;  VAR filename: String; VAR err: integer)+  len, newfilename = savebuffer(start filelen , file_name , file_extension , message)
  
 Writes the telegram buffer starting at position "start" by reading "filelen" number of bytes into the file "filename" Writes the telegram buffer starting at position "start" by reading "filelen" number of bytes into the file "filename"
  
-The number of bytes written will be returned in "len".+The number of bytes written will be returned in "len", a negative value means a load error
  
 The following conditions apply: The following conditions apply:
-  * If the filename is "" (empty), then a file selection window will be opened, from which a file can be selected. The selected file name will be returned in "filename".+  * The selected file name will be returned in "filename".
   * If len is 0, the whole telegram buffer will be written.    * If len is 0, the whole telegram buffer will be written. 
  
-==== setbuffer ==== +=== setbuffer === 
-  setBuffer(bufferNr : byte; newSize: longint)+  setBuffer(bufferNr newSize )
  
-Changes the actual buffer used to buffer number "buffernr"SKDS supports 10 buffers, counted from 0 to 9. The startup buffer is nr. 0.+Changes the actual buffer used to buffer number "buffernr"OOBD supports 10 buffers, counted from 0 to 9. The startup buffer is nr. 0.
  
-If newsize is <> 0, the old buffer is deleted and new memory with size newmem is allocated. The maximal memsize is 2^31 = 2147483648 bytes+If newsize is <> 0, the old buffer is deleted and new memory with size newmem is allocated
  
  
-==== copyBuffer ==== +=== copyBuffer === 
-  copyBuffer(bufferNr : byte)+  copyBuffer(bufferNr )
  
-Copies the content of buffer nr. "bufferNr" into the actual buffer.+Copies the content of buffer  "bufferNr" into the actual buffer.
  
  
  
  
-==== BlitBuffer ==== +=== BlitBuffer === 
-  BlitBuffer(frombuffer: byte; startpos: longint; topos: longint; blocklen: longint )+  BlitBuffer(frombuffer startpos topos blocklen  )
  
 Copies a memory block  from the buffer "frombuffer" starting at position "startpos" to the actual buffer to position "topos" with the length of "blocklen" bytes. Copies a memory block  from the buffer "frombuffer" starting at position "startpos" to the actual buffer to position "topos" with the length of "blocklen" bytes.
Line 276: Line 278:
 In case the buffer len needs to be bigger, the buffer len is increased accourdingly. In case the buffer len needs to be bigger, the buffer len is increased accourdingly.
  
-==== SetBufferLen ====+=== SetBufferLen ===
  
  
-  SetBufferLen(VAR newSize: longint)+ newSize= SetBufferLen( newSize)
  
 All other buffer commands can increase the 'len' of a buffer, but none of them can make a buffer shorter, except SetBufferLen.  All other buffer commands can increase the 'len' of a buffer, but none of them can make a buffer shorter, except SetBufferLen. 
Line 285: Line 287:
 SetBufferLen sets the 'len' of the current Buffer to 'newSize'. SetBufferLen sets the 'len' of the current Buffer to 'newSize'.
  
-The success of the SetBufferLen - operation is returned in the variable newSize itself as follows:+The success of the SetBufferLen - operation is returned as function result as follows:
  
-^  input value of newSize  ^  return value of newSize  ^+^  input value of newSize  ^  return value   ^
 |  < = 0                    | available size of the buffer in bytes. This can be used to read the real allocated memory size of that buffer  | |  < = 0                    | available size of the buffer in bytes. This can be used to read the real allocated memory size of that buffer  |
 |  1.. available size      | new available size (= requested size)  | |  1.. available size      | new available size (= requested size)  |
Line 293: Line 295:
  
 As seen, a negative value given back indicates a fault condition, all other returned values are positive. As seen, a negative value given back indicates a fault condition, all other returned values are positive.
 +
 +
 +=== SendBuffer ===
 +Sends the actual buffer
 +
  
  
doc/lua_make-your-own-scripts.txt · Last modified: 2019/04/08 18:43 by admin