[Video] Cheat Engine Lua Module

Post and find Lua tutorials here.
Post Reply
TheyCallMeTim13
Posts: 16
Joined: Tue Apr 25, 2023 4:27 pm

[Video] Cheat Engine Lua Module

Post by TheyCallMeTim13 »

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
Post Reply