Discord
Login
Community
DARK THEME

Help me with this pls

init = function()
  text = system.prompt("Enter name of project: ")
end

update = function()
  print(text)
end

draw = function()
  screen.clear()
  screen.drawText(text, 0, 0, 20, "white")
end

No matter what you put in, it will output 3. How do i fix this?

you outputing system.prompt which isn't how you get the text you need callback to access the text so

init = function()
  text = "Waiting for input..."
  system.prompt("Enter name of project:", function(ok, userInputText)
    if ok then
      text = "Project Name: " + userInputText
    else
      text = "Input Cancelled"
    end
  end)
end

update = function()
  print(text)
end

draw = function()
  screen.clear()
  screen.drawText(text, 0, 0, 20, "white")
end

Thanks!

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community