Difference between revisions of "Lua:Class:TableFile"

From Cheat Engine
Jump to navigation Jump to search
(Created page with 'TableFile '''class''': ('''Inheritance''': ''Object'') Class for Cheat Engine Table Files (CE Form->Menu->Table) Table files can be added from the Cheat Engine form. …')
 
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
TableFile '''class''': ('''Inheritance''': ''[[Object]]'')
+
[[Category:Lua]]
 +
TableFile '''class''': ('''Inheritance''': ''[[Lua:Class:Object|Object]]'')
  
 
Class for Cheat Engine Table Files (CE Form->Menu->Table)
 
Class for Cheat Engine Table Files (CE Form->Menu->Table)
Line 5: Line 6:
 
Table files can be added from the Cheat Engine form.
 
Table files can be added from the Cheat Engine form.
 
* CE Form->Menu->Table->Add file
 
* CE Form->Menu->Table->Add file
 +
 +
== Creation ==
 +
; [[Lua:findTableFile|findTableFile]](''fileName'') : TableFile
 +
: Returns the TableFile class object for the saved file
 +
 +
; [[Lua:createTableFile|createTableFile]](''fileName'', ''filePath'' OPTIONAL) : TableFile
 +
: Returns a newly added table file.
 +
: If no file path is specified, it will create a blank file. Otherwise, it will read the contents from disk.
  
 
== Properties ==
 
== Properties ==
Line 10: Line 19:
 
: The table file's name.
 
: The table file's name.
  
; Stream : [[MemoryStream]]
+
; Stream : [[Lua:Class:MemoryStream|MemoryStream]]
: The table file's underlying [[MemoryStream]] object.
+
: The table file's underlying [[Lua:Class:MemoryStream|MemoryStream]] object.
  
 
== Methods ==
 
== Methods ==
Line 17: Line 26:
 
: Saves the TableFile to the given file path.
 
: Saves the TableFile to the given file path.
  
; getData() : [[MemoryStream]]
+
; getData() : [[Lua:Class:MemoryStream|MemoryStream]]
: Returns the table file's underlying [[MemoryStream]] object.
+
: Returns the table file's underlying [[Lua:Class:MemoryStream|MemoryStream]] object.
  
 
== Examples ==
 
== Examples ==
Line 24: Line 33:
 
  local tableFile = findTableFile('PlayerBaseHook.CEA')
 
  local tableFile = findTableFile('PlayerBaseHook.CEA')
 
  if tableFile ~= nil then
 
  if tableFile ~= nil then
local stringStream = createStringStream()
+
  local stringStream = createStringStream()
stringStream.Position = 0 -- if not set before using 'copyFrom' the 'StringStream' object will be inconsistent.
+
  stringStream.Position = 0 -- if not set before using 'copyFrom' the 'StringStream' object will be inconsistent.
stringStream.copyFrom(tableFile.Stream, tableFile.Stream.Size)
+
  stringStream.copyFrom(tableFile.Stream, tableFile.Stream.Size)
fileStr = stringStream.DataString
+
  fileStr = stringStream.DataString
stringStream.Destroy()
+
  stringStream.destroy()
 
  end
 
  end
  
== See also ==
+
{{LuaSeeAlso}}
* [[Lua]]
 
* [[Help_File:Script engine|Script engine]]
 
  
 
=== Related Functions ===
 
=== Related Functions ===
* [[findTableFile]]
+
* [[Lua:createTableFile|createTableFile]]
* [[createMemoryStream]]
+
* [[Lua:findTableFile|findTableFile]]
* [[createFileStream]]
+
* [[Lua:createMemoryStream|createMemoryStream]]
* [[createStringStream]]
+
* [[Lua:createFileStream|createFileStream]]
 +
* [[Lua:createStringStream|createStringStream]]
  
 
=== Related Classes ===
 
=== Related Classes ===
* [[MemoryStream]]
+
* [[Lua:Class:MemoryStream|MemoryStream]]
* [[FileStream]]
+
* [[Lua:Class:FileStream|FileStream]]
* [[StringStream]]
+
* [[Lua:Class:StringStream|StringStream]]
* [[Stream]]
+
* [[Lua:Class:Stream|Stream]]

Latest revision as of 02:13, 25 January 2018

TableFile class: (Inheritance: Object)

Class for Cheat Engine Table Files (CE Form->Menu->Table)

Table files can be added from the Cheat Engine form.

  • CE Form->Menu->Table->Add file

Creation[edit]

findTableFile(fileName) : TableFile
Returns the TableFile class object for the saved file
createTableFile(fileName, filePath OPTIONAL) : TableFile
Returns a newly added table file.
If no file path is specified, it will create a blank file. Otherwise, it will read the contents from disk.

Properties[edit]

Name : string
The table file's name.
Stream : MemoryStream
The table file's underlying MemoryStream object.

Methods[edit]

saveToFile(filePath)
Saves the TableFile to the given file path.
getData() : MemoryStream
Returns the table file's underlying MemoryStream object.

Examples[edit]

local fileStr = nil
local tableFile = findTableFile('PlayerBaseHook.CEA')
if tableFile ~= nil then
  local stringStream = createStringStream()
  stringStream.Position = 0 -- if not set before using 'copyFrom' the 'StringStream' object will be inconsistent.
  stringStream.copyFrom(tableFile.Stream, tableFile.Stream.Size)
  fileStr = stringStream.DataString
  stringStream.destroy()
end

See also[edit]

Related Functions[edit]

Related Classes[edit]