Hi
- User
Hi
- Assistant
Hello! How can I assist you today?
- User
Script error: luaj.o: /storage/emulated/0/Download/Telegram/badcasefieldfinder.lua:24
local taggedAddress = addTag(result[1].address) -- Add the tag hereattempt 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) - 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
nilvalue with a key 'address', specifically at the following line of your code:local taggedAddress = addTag(result[1].address) -- Add the tag hereHere's what seems to be happening:
resultis expected to be a table with at least one entry which itself is a table containing an 'address' field.- However,
result[1]isnil, which means that eitherresultis an empty table or not a table at all. - When the script tries to access the 'address' field of a
nilvalue, it triggers the error.
To resolve this issue, you need to ensure that
resultis properly populated before you try to access its 'address' field. Here are some steps you might take:- Check the function that populates
resultto 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 ifresult[1]isniland 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.") endIf you include more information about where
resultcomes 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. - 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 - 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
resulttable returned bygg.getResults(1, 1). The error arises whenresult[1]isnil, which suggests that the search operation did not return any results.You can prevent the error by verifying that
resulthas at least one item and that the item is notnilbefore attempting to use its 'address' key. Here's the modified section of yourfunctionName1()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:
- An if-statement to check that
resultis valid, non-empty, and contains at least one result. - An
elseblock to handle the case when the search returns no results, thereby preventing the attempt to access anilvalue'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 exitsfunctionName1()without further execution. You might need to handle such cases depending on the desired behavior of your script. - An if-statement to check that
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- gpt-3.5-turbo-0301Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-3.5-turbo-0301Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →
- gpt-4-0314Compare side by side →