Jump to content

Recommended Posts

Posted

Pure Lua library



import this lib to your script : 
setup

XEK = nil
load_lib = gg.makeRequest('https://raw.githubusercontent.com/chihaamin/XEKEX/main/xLIB.lua')
if load_json_lib.code == 200 then -- check the status of the request
 XEK = load(load_json_lib.content,'bt')()
end


Comment if you find a bug / error or if you have Idea for implementation.
• All the file is documented and commented for beginners.
 Add "XEKEX was here" in your script if it was helful 🙂 
-------------------------------------------------------------------------------

IMPORT
 

JSON = XEK.import('https://raw.githubusercontent.com/rxi/json.lua/master/json.lua') -- this will import a lib into your script 

JSON.decode(response.content)



Text2Dword

 

-- Text2Dword function Convert a text to dword value
local DWORD = XEK.Text2Dword("berry")

-- Print the result
print(DWORD) --> Output: '6619234;7471218;121::9'



Dword2Text :

 

-- Dword2Text function Convert a Dword value to text
local sampleValue = "6619234;7471218;121"
local text = XEK.Dword2Text(sampleValue)

-- Print the result
print(text) --> Output: 'berry'


hex : 

 

The 'hex' function takes two arguments: a value to convert to hexadecimal and a boolean 'hx' indicating whether to add '0x' or 'h' prefix to the output.

--[[
If hx is true, the function returns the hexadecimal value with '0x' prefix.
If hx is false, the function returns the hexadecimal value with 'h' suffix.
If hx is not provided or not a boolean, the function returns the hexadecimal value without any prefix or suffix.
The function uses string formatting to convert the value to hexadecimal.
]]

--> Examples:

--Convert decimal value to hexadecimal with '0x' prefix
print(XEK.hex(255, true)) --> Output: 0xFF

--Convert decimal value to hexadecimal with 'h' suffix
print(XEK.hex(255, false)) --> Output: FFh

--Convert decimal value to hexadecimal without any prefix or suffix
print(XEK.hex(255)) --> Output: FF



dump : 

 

--[[
dump function takes a table as input and returns a string representation of the table.
If the input is not a table, it returns a string representation of the input.

Parameters:

tab (table): the table to be dumped
Returns:

(string): the string representation of the table
]]
--> Example usage:

local myTable = {name = "John", age = 30, hobbies = {"reading", "running"}}
print(XEK.Dump(myTable))
-- Output: { ["name"] = "John", ["age"] = 30, ["hobbies"] = { [1] = "reading", [2] = "running", } }


split : 

 

--split function splits a string into a table of substrings using a specified delimiter

--The function takes two parameters: s, which is the string to be split, and delimiter, which is the character or string used to separate the substrings

--> Example usage:
local myString = "apple,banana,cherry,orange"
local myTable = XEK.split(myString, ",")

-- The above code will split the string "apple,banana,cherry,orange" into substrings using the comma as the delimiter and store the result in a table called myTable

--The resulting table will contain the following values:

myTable[1] = "apple"
myTable[2] = "banana"
myTable[3] = "cherry"
myTable[4] = "orange"



ARMIT fix
 

--# Example 1: Converting an Integer to Assembly Instructions

local instructions = XEK.ARMIT(123456, "int", true)

--The above function call will generate assembly instructions to move the value 123456 into a register in AArch64.

--> Output:
 instructions = {
[1] = '~A8 MOVK W0, #0xE240, LSL #16',
[2] = '~A8 MOVK W0, #0x0001, LSL #32',
[3] = '~A8 RET',
}


--# Example 2: Converting a Boolean to Assembly Instructions

local instructions = XEK.ARMIT(true, "bool")

--The above function call will generate assembly instructions to move the value 1 (true) into a register in AArch32.

--> Output:
 instructions = {
[1] = '~A MOV R0, #0x1',
[2] = '~A BX LR',
}


--# Example 3: Converting a Float to Assembly Instructions

local instructions = XEK.ARMIT(3.14159, "f", true)

--The above function call will generate assembly instructions to move the value 3.14159 into a floating point register in AArch64.

--> Output:
instructions = {
[1] = '~A8 MOVK W0, #0x0FD0, LSL #16',
[2] = '~A8 MOVK W0, #0x4049, LSL #32',
[3] = '~A8 FMOV S0, W0',
[4] = '~A8 RET',
}


--# Example 4: Converting a Double to Assembly Instructions

local instructions = XEK.ARMIT(123456789.987654321, "d")

--The above function call will generate assembly instructions to move the value 123456789.987654321 into a double precision floating point register in AArch32.

--> Output:
 instructions = {
[1] = '~A MOVW R0, #0x5BA8',
[2] = '~A MOVT R0, #0x57F3',
[3] = '~A MOVW R1, #0x6F34',
[4] = '~A MOVT R1, #0x419D',
[5] = '~A VMOV D0, R1, R0',
[6] = '~A BX LR',
 }



readBytes   |  readWord  |  readDword  |  readFloat  |  readDouble :

 

local words = XEK.readWord(addr, size, ';')       <-| return a string
local dwords = XEK.readDword(addr, size, '-')     <-| return a string
local floats = XEK.readFloat(addr, size, '|')     <-| return a string
local doubles = XEK.readDouble(addr, size, ':')   <-| return a string

--    OR

local words = XEK.readWord(addr, size)            <-| return a table
local dwords = XEK.readDword(addr, size)          <-| return a table
local floats = XEK.readFloat(addr, size)          <-| return a table
local doubles = XEK.readDouble(addr, size)        <-| return a table

--<< these function purpose is to read values from memory for comparison >>--



getResults : 

 

--# Example usage of getResults function and its returned table
local t = XEK.getResults(10) or t = XEK.getResults()               <-|-- Get 10 results or all result | you can specified parameter same as GG
print(t.data[1].address)                                           <-|-- Print the address of the first result

--# Example usage of focus function
t:focus()                                                          <-|-- Save original values of results table
print(t.original[1])                                               <-|-- Print the original value of the first result

--# Example usage of update function
t:update(999)                                                      <-|-- Set all values in result table to 999

--# Example usage of reset function
t:reset()                                                          <-|-- Reset all values in result table to their original values

--# Example usage of offset function
t:offset(0x8)                                                      <-|-- Add 8 to the address of each result

--# Example usage of append function
local t2 = XEK.getResults(5)                                           <-|-- Get 5 more results
t:append(t2)                                                       <-|-- Append t2 results to t
print(#t.data)                                                     <-|-- Print the total number of results in t

--# Example usage of get function
t:get()                                                            <-|-- Refresh the results table

--# Example usage of clear function
t:clear()                                                          <-|-- Destroy the results table and clear garbage



MakeMenu : 

 

-- Create a new menu object
local myMenu = XEK.MakeMenu().Menu:new({"Option 1", "Option 2", "Option 3"})   |   this will add Menues

-- Add a new action to the menu
myMenu.actions:new(1, function() -- argument 1 is the index of menu ( option 1 function ) | index must be a number
    print("Option 1 was selected!")
end)

myMenu.actions:new(2, function()  
    print("Option 2 was selected!")
end)

--    etc
--    .
--    .
--    .


-- Display the menu and wait for the user to make a selection
myMenu:display()

--whenever the user select a menu item it will trigger the functions inside myMenu.actions ( created with myMenu.actions:new(index, function) )


 


  • Submitter
  • Submitted
    01/13/2023
  • Category

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.