Skip to content
TheChatArchiveThe Chat Archive
gpt-4-1106-preview· OpenAIAi2 WildChat-4.8M (AI2)

Hi

  1. User

    Hi

  2. Assistant

    Hello! How can I assist you today?

  3. User

    Script error: luaj.o: /storage/emulated/0/Download/Telegram/badcasefieldfinder.lua:24 local taggedAddress = addTag(result[1].address) -- Add the tag here attempt to index ? (a nil value) with key 'address' (field '1') level = 1, const = 40, proto = 1, upval = 1, vars = 20, code = 191 GETTABLE v12 v12 "address" ; PC 45 CODE 06440307 OP 7 A 12 B 12 C 272 Bx 6416 sBx -124655 stack traceback: /storage/emulated/0/Download/Telegram/badcasefieldfinder.lua:24 in function 'functionName1' /storage/emulated/0/Download/Telegram/badcasefieldfinder.lua:93 in function 'home' /storage/emulated/0/Download/Telegram/badcasefieldfinder.lua:101 in main chunk [Java]: in ? at luaj.LuaValue.f(Unknown Source:2) at luaj.LuaValue.c(Unknown Source:35) at luaj.LuaValue.i(Unknown Source:47) at luaj.LuaValue.w(Unknown Source:0) at luaj.LuaClosure.a(Unknown Source:588) at luaj.LuaClosure.l(Unknown Source:7) at luaj.LuaClosure.a(Unknown Source:1750) at luaj.LuaClosure.l(Unknown Source:7) at luaj.LuaClosure.a(Unknown Source:1750) at luaj.LuaClosure.l(Unknown Source:7) at android.ext.Script.d(Unknown Source:493) at android.ext.Script$ScriptThread.run(Unknown Source:16)

  4. Assistant

    The error message you're seeing indicates that there's an issue with the Lua script you're trying to run. The script is attempting to index a nil value with a key 'address', specifically at the following line of your code:

    local taggedAddress = addTag(result[1].address) -- Add the tag here
    

    Here's what seems to be happening:

    1. result is expected to be a table with at least one entry which itself is a table containing an 'address' field.
    2. However, result[1] is nil, which means that either result is an empty table or not a table at all.
    3. When the script tries to access the 'address' field of a nil value, it triggers the error.

    To resolve this issue, you need to ensure that result is properly populated before you try to access its 'address' field. Here are some steps you might take:

    • Check the function that populates result to make sure it's returning what you expect.
    • Add error checking before you try to use result[1]. For instance, you could add a conditional to check if result[1] is nil and handle that case appropriately.

    Here's an example of how you might modify your script to include error checking:

    if result and result[1] then
        local taggedAddress = addTag(result[1].address) -- Add the tag here
    else
        -- Handle the case where result is empty or nil
        print("Error: 'result' is nil or does not contain an entry.")
    end
    

    If you include more information about where result comes from, I might be able to give more specific advice. But the general idea is that you need to make sure your variables are initialized correctly before you attempt to perform operations on them.

  5. User

    This is script which getting error.function functionName1() local POINTER_TAG = 0xB4 local TAG_SHIFT = 56

    local function addTag(pointer)
        return pointer | (POINTER_TAG << TAG_SHIFT)
    end
    
    -- Prompt the user for class name and offset
    local prompts = {'Class name', 'Offset'}
    local defaults = {'RankedPlayerDatum', 0x18} -- Removed quotes around the offset
    local types = {'text', 'number'}
    local input = gg.prompt(prompts, defaults, types)
    
    if input and input[1] then
        -- Use input[1] as class name and input[2] as offset
        local ClassName = input[1]
        local Offset = input[2]
    
        -- Now let's search for the tagged address
        local searchPattern = "Q 00 '"  ..ClassName .. "' 00"
        gg.searchNumber(searchPattern, nil, nil, nil, nil, 1)
        local result = gg.getResults(1, 1)
        local taggedAddress = addTag(result[1].address) -- Add the tag here
    
        -- Rest of your code...
    else
        -- Exit the function if the user cancels the prompt or provides no input
        return
    end
    
    
    
    
    
    
    -- Rest of your code...
    
    
    
    
    local ggType = gg.TYPE_DWORD
    local structOffset
    local pointerType
    if isX64 == true then
        structOffset = 16
        pointerType = gg.TYPE_QWORD
    else
        structOffset = 8
        pointerType = gg.TYPE_DWORD
    end
    gg.clearResults()
    
    
    gg.setRanges(gg.REGION_C_ALLOC | gg.REGION_ANONYMOUS | gg.REGION_C_DATA)
    gg.searchNumber(taggedAddress, pointerType) -- search for the tagged address
    
    local tempResults = gg.getResults(gg.getResultsCount())
    for i, v in pairs(tempResults) do
        tempResults[i].address = tempResults[i].address - structOffset
    end
    gg.clearResults()
    gg.setRanges(gg.REGION_ANONYMOUS)
    gg.loadResults(tempResults)
    gg.searchPointer(0)
    tempResults = gg.getResults(gg.getResultsCount())
    gg.clearResults()
    gg.setRanges(gg.REGION_ANONYMOUS)
    gg.loadResults(tempResults)
    gg.searchPointer(0)
    tempResults = gg.getResults(gg.getResultsCount())
    local tempTable = {}
    for i, v in pairs(tempResults) do
        tempTable[i] = {
            address = v.value,
            flags = pointerType
        }
    end
    tempResults = gg.getValues(tempTable)
    for i, v in pairs(tempResults) do
        tempResults[i].address = tempResults[i].address + Offset
        tempResults[i].flags = ggType
    end
    gg.loadResults(tempResults)
    il2cppFieldsTable = gg.getResults(gg.getResultsCount())
    
    gg.toast('ℹ️ Menu Name Complete ℹ️')
    

    end function home() local menu = gg.choice({'Menu Name', } ,nil , 'Script Name') if menu ~= nil then if menu == 1 then functionName1() end end end

    while true do if gg.isVisible() then gg.setVisible(false) home() end gg.sleep(100)

    end
    
  6. Assistant

    Given the script you've posted, it appears there's a logical error when attempting to access the 'address' key on the first element of the result table returned by gg.getResults(1, 1). The error arises when result[1] is nil, which suggests that the search operation did not return any results.

    You can prevent the error by verifying that result has at least one item and that the item is not nil before attempting to use its 'address' key. Here's the modified section of your functionName1() function with added error checking:

    -- ... previous code ...
    
    -- Now let's search for the tagged address
    local searchPattern = "Q 00 '"  .. ClassName .. "' 00"
    gg.searchNumber(searchPattern, nil, nil, nil, nil, 1)
    local result = gg.getResults(1, 1)
    
    -- Added error checking to prevent accessing 'address' key of a nil value
    if result and #result > 0 and result[1] then
        local taggedAddress = addTag(result[1].address) -- Add the tag here
    
        -- ... rest of your code where you use taggedAddress ...
    
    else
        gg.toast('No results found for the given class name and offset.')
        return -- Exit the function because no valid result was found
    end
    
    -- ... rest of your code ...
    

    Here's what I've added:

    1. An if-statement to check that result is valid, non-empty, and contains at least one result.
    2. An else block to handle the case when the search returns no results, thereby preventing the attempt to access a nil value's keys.

    This should fix the immediate error, but please note that if the gg.searchNumber() function doesn't find any results, your script outputs a toast message and exits functionName1() without further execution. You might need to handle such cases depending on the desired behavior of your script.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.