0
votes

I am new to Corona and Lua.
is it possible to do something like an "a href" in Lua? I am having a button and I need it to link it to other page but I can't seem to find a way to do it. I am not trying to infuse HTML code to Lua. I just need a way to perform a function like this(in Lua language). I have googled and even look at the manual of Lua and corona docs but still unable to find anything similar to it.
To people who know this, please advice. Thankss

2
what do you want to do? do you want to open a web page when a button is clicked or what?Piglet
@Piglet no i just want to link it to another app screen page that i have createdNoobProgrammer

2 Answers

0
votes

Clicking a button will cause an event. You can implement a function that handles this event and for example shows another page. Please read the Corona manual and do some basic tutorials. All information you need is there.

From: https://docs.coronalabs.com/api/library/widget/newButton.html

onPress (optional) Listener. An optional function to be called when the button is pressed. The callback function does not require testing for event.phase since it only honors "began".

https://docs.coronalabs.com/api/type/Listener.html

Events are dispatched to listeners. Event listeners can be either functions or table objects.

In both cases, when an event occurs, the listener will be invoked and be supplied with a table representing the event. All events have a name property that corresponds to the name you use to register the event.

For more information, see the Basic Interactivity and Event Detection guide.

https://docs.coronalabs.com/guide/events/detectEvents/index.html

To find out how to switch "pages" or scenes read

https://docs.coronalabs.com/guide/system/composer/index.html

0
votes

For adding a reference in a button:

local button =

div {

  a{["data-toggle"]="modal", 
   ["data-backdrop"]="static",
    href="#refrence-modal",
 }

Or, you may add button inside a form:-

  1. define the action of the form
  2. make the button type as submit