I want to use “Input” in “Dirty Larry GUI”. But when I press the button after inputting, the text of “Input” is not initialized. I tried gui.set_text (“button / content”, “”) and the ‘console’ was initialized. But the text still remained on the screen. What should I do?
There isn’t an easy way to change/clear an input field, but there really should be! Try adding this function below your require statement for dirtylarry;
local dirtylarry = require "dirtylarry.dirtylarry"
function dirtylarry.set_input(self, node, txt)
local node_content = gui.get_node(node .. "/content")
local url = msg.url()
local key = tostring(url.socket) .. hash_to_hex(url.path) .. hash_to_hex(url.fragment or hash("")) .. node
dirtylarry.input_nodes[key].data = txt
gui.set_text(node_content, txt)
end
then in your button callback, call dirtylarry:set_input("name1", ""), something like this: