Jump to content
Sign in to follow this  
  • entries
    125
  • comments
    7
  • views
    3998

From the Forum – Issue #168

Sign in to follow this  
CoronaRob

1003 views

Welcome to this week’s From the Forum. In this post, we highlight a few Corona Community Forums posts that cover important topics.

Modules, modules, modules

Developers love to build their own libraries. The bigger they get, the more important organization of the code becomes. In this thread, learn some strategies for maintaining modules in your code.

Moving containers

The original poster’s question was curious how to move a display object so that it only shows part of the object, depending on the position. Think of moving a character in front of an X-Ray machine. Enter containers. This thread goes into quite a bit of depth on how to use containers to partially reveal objects.

Cool Lua syntax

The original poster saw some Lua syntax that wasn’t familiar. Enter forum superstar @roaminggamer with a great explanation on single line conditionals to populate variables in this thread.


Do you have a particular forum thread that was helpful for you? Let us know about it! Email support@coronalabs.com, put FTF: and the forum title in the subject, and include the URL in the email. We will consider adding it to an upcoming edition of From the Forum.


View the full article

Sign in to follow this  


1 Comment


Recommended Comments

I'm not sure if this is a bot but oh well.

That cool Lua syntax has a small issue that if the second value is falsy (nil or false, nothing else in Lua is falsy like thing in PHP, Python or JS are, but in Python there is a dedicated conditional anyway) it'll assigng the last no matter what so it's not a 100% equivalent for an if to pick between false and nil.

I.e.:

$ lua51
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print((1 == 2) and false or nil)
nil
> print((1 == 1) and false or nil)
nil
> print((1 == 1) and 3 or nil)
3
> print((1 == 2) and 3 or nil)
nil

 

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!