Yes, you can create a dictionary (table) in Lua to pair block names with their corresponding values. Then, use gg.prompt() to let the user input a block name, check if it exists in the table, and retrieve the corresponding integer. Here's an example of how you can implement it in GG Lua:
local blocks = {
["dirt"] = 1048,
["stone"] = 1050,
["sand"] = 1062,
-- Add more block names and their values here
}
local input = gg.prompt({"Enter block name:"}, {}, {"text"})
if input and input[1] then
local targetValue = blocks[input[1]:lower()]
if targetValue then
gg.searchNumber("1048", gg.TYPE_DWORD)
gg.editAll(targetValue, gg.TYPE_DWORD)
gg.toast("Changed dirt to " .. input[1])
else
gg.alert("Block name not found in the list!")
end
end
This allows users to input a block name, look it up in the table, and replace the original value with the correct integer. Just make sure to expand the blocks table with all necessary block types. Hope this helps!