[Video] Cheat Engine Lua Module

Section's for general approaches on hacking various options in games. No online-related discussions/posts OR warez!
Post Reply
User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1613
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 580

[Video] Cheat Engine Lua Module

Post by TheyCallMeTim13 » Mon May 20, 2019 11:15 am

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
CE wiki - Tutorials CE wiki - Auto Assembler Basics - CE wiki - Lua Basics If it's not a Personal Message don't PM me, use the forum. I ignore PMs that should be asked on the forum.

Post Reply

Who is online

Users browsing this forum: No registered users