Page 1 of 1

[Video] Cheat Engine Lua Module

Posted: Mon May 20, 2019 11:15 am
by TimFun13
Cheat Engine Lua Module



In this video I go over setting up a Lua module and how to import it as Cheat Engine table file.





Code: Select all

--------
-------- CE Table Require
--------
local tableLuaFilesDirectory = 'luaFiles'
local fileExt = '.lua'
function CETrequire(moduleStr)
 if moduleStr ~= nil then
 local localTableLuaFilePath = moduleStr
 if tableLuaFilesDirectory ~= nil and tableLuaFilesDirectory ~= '' then
 local sep = package.config:sub(1,1)
 localTableLuaFilePath = tableLuaFilesDirectory .. sep .. moduleStr
 end
 local f, err = io.open(localTableLuaFilePath .. fileExt)
 if f and not err then
 f:close()
 return dofile(localTableLuaFilePath .. fileExt)
 else
 local tableFile = findTableFile(moduleStr .. fileExt)
 if tableFile == nil then
 return nil
 end
 local stream = tableFile.getData()
 local fileStr = nil
 local bytes = stream.read(stream.Size)
 for i = 1, #bytes do
 if fileStr == nil then
 fileStr = ''
 end
 fileStr = fileStr .. string.char(bytes[i])
 end
 if fileStr then
 return loadstring(fileStr)()
 end
 end
 end
 return nil
end