[Lua] How to create 2d UI Elements?

So, I have experience with Lua but normally I’m provided with a workspace to create UI work and then be able to reference them via script. I’m not sure how I can “Create” UI work out of code alone. Could someone give me some examples or tell me how? 

I’d also like to know how I could add Images. I’ve seen many people just do “something.png” and be able to load in the image. How does it work? 

I’m fairly new so all help would be appreciated! Thank you.

Right now, I can only print stuff in the output console, If you’re curious, I’m making a “Login” ui so I need to be able to create textbox if possible. Also it would be nice if someone provided all the objects I could create.

Are you just using Lua or are you using Corona?  This is a very important question, because almost every computer language doesn’t have built-in UI features other than prompting for input from a terminal console and printing the results. You always need something more than just the language to do this. 

Corona is a framework that gives you the API’s (function calls) that you need to put images on the screen, show text boxes, react to input, etc. Lua is the language, Corona is the API Library/Framework/Engine that does the heavy lifting.

FWIW, these forums are for people using Corona to build mobile, desktop, TV and HTML5 apps. Corona uses Lua as it’s core language, but all the tools you’re asking about is done with Corona APIs.

Rob

@iverson  Check out some of the sample projects that come in the Corona folder.  You might find what you are looking for there and it’s a great way to learn Corona.

@Rob Miracle, yes I am using Corona as the platform. I’m just not sure how to do it. When I installed corona, I got a bunch of dll files, I would love examples of people using Corona to create UI elements. 

@sporkfin thanks I’ll check it out later, I’m currently as school.

Also is there a database for the API’s corona provides?

Have you gone through our Getting Started Guide yet? http://docs.coronalabs.com/guide/programming/index.html

Corona has built-in support for SQLite with regards to databases.

Rob

@Rob Miracle, how would I be able to create textboxs for logins or how would I be able to make like a google login etc?

There is a sample project here: https://github.com/coronalabs-samples/business-app-sample that has some simple form setups as well as database usage (in addition to a bunch of other stuff). In the SampleApps folder that ships with Corona there is a whole section on Interface things from text boxes to buttons and tableViews, etc. The link above is a complete working app, the samples are a little more “show off this particular API or set of APIs”. At that same site is a fully functional Weather app that shows how to use a lot of interface elements.

We just published a guest tutorial this week on the blog about using Google and Apple to do sign ins. You can also use the Facebook plugin to set up a Facebook login. There are also a couple of plugins (PlayFab, GameSparks) that provide social media type login activities as well.

But if you want to setup your own username/password system, not only will you need a form to log them in, you will need a form to let them create an account. You will need server API endpoints (perhaps created in PHP, Node.js, .NET etc.) to handle the sign in and registration (unless you’re using a service like PlayFab). You will have to become an expert on Internet security, password encryption, authorization tokens, etc. because you don’t want your user database to be hacked. 

Is this scary? Yes. 

Since you haven’t said what kind of multiplayer game you’re wanting to make (a simple turn based game like Words with Friends) or a complex multi-player RPG, it’s really hard to advise you on the route you should take,

But I can say this, don’t bite off more than you can chew. Since you’re just learning Corona and Lua, take the time and build a bunch of small simple games and don’t jump straight to the harder complex game. It can wait until your skills are ready.

Rob

Is there a way using corona to have the user input data into an app, like in a text box. And to store that data would I use “json”?

Sure, see our Business App sample: https://github.com/coronalabs-samples/business-app-sample

You are looking for the native.textField() API: http://docs.coronalabs.com/api/library/native/newTextField.html

and native.textBox() API: http://docs.coronalabs.com/api/library/native/newTextBox.html

Rob

@ Rob Miracle is there an example of an analytical app sample, because that’s more what I’m going for.

There is a plugin I need to get into the marketplace that does several types of graphs and it has a sample app that shows you how to use it. That could help you.

Corona probably has all the fundamental elements needed to build an app, but we don’t have any samples that do that.

Rob