Posts – Corona Labs

By Corona Geek

About this podcast   English    United States

Whether you're new to Corona or want to take your app to the next level, we've got a wealth of resources for you including extensive documentation, API reference, sample code, and videos!
In this podcast

Posts

Corona Labs

Machine generated. There may be errors. Report errors to us.
April 6, 2018
No audio available for this episode
Welcome to this week’s From the Forum. In this post, we highlight a few Corona Community Forums posts that cover important topics. HTML5 server awesomeness Corona mega-developer @develephant has gone full overdrive creating some great tools to go along with HTML5 builds. In his latest creation, he’s created a plugin to let HTML5 builds work with his Coronium Core server product. In addition he’s created some command line tools to speed up your HTML5 development. Check out the goodness here! Converting numbers in Lua Most people work in Lua with base 10 or decimal numbers, i.e. everything you do is with digits between 0 and 9. But there are other times where you might want to display numbers in different formats, such as hexadecimal or base 16 numbers where digits range from 0 to F. In this thread, @roaminggamer addressed an easy way to convert Lua numbers to other representations other than normal numbers. Things that go “Bleep” In this post, a Corona user was getting odd sounds every time Corona generated a run-time error. After a little investigating, the sounds were being generated by the operating system. On Windows, it’s standard for apps with errors to play a system sound. On macOS a notification is generated. Both of these sounds are controlled by the operating system. The solution? This forum post has you covered! Do you have a particular forum thread that was helpful for you? Let us know about it! Email [email protected], 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.
April 4, 2018
No audio available for this episode
Our HTML5 team has been quite busy and HTML5 builds are progressing nicely. There is a recent change that we hope you will find exciting. We’ve found a way to get HTML5 builds down to around 1 megabyte. Of course the more art and audio assets you add, the more your app will grow in size. We’ve accomplished this by temporarily removing the SQLite3 and socket modules and compressing the engine code. Starting with daily build 2018.3055, these modules have been removed for HTML5 builds. We will bring them back in a future build as optional modules. If you haven’t given HTML5 a try, now’s a good time to start experimenting with it. We have even simplified testing. Instead of starting up your own local web server, we do that for you with the use of our Live Server. Simply build your HTML5 app and it will open in your default web browser automatically. As always, while it’s in open beta, please report any issues you run into in our HTML5 forum.
March 23, 2018
No audio available for this episode
Welcome to this week’s From the Forum. In this post, we highlight a few Corona Community Forums posts that cover important topics. Spamming buttons Sometimes repeated button presses are okay, but frequently they’re not. How do you defend against them? In this thread, our developer community chimed in with some different ways to prevent rapid button presses. Wow, that was fast! We just announced HTML5 builds in open beta this week and our ever-diligent community developer @develephant has already started creating useful plugins. Check out this thread to get an easy to use Cookie Set/Get/Delete plugin. Daily quests? Many games offer players daily tasks to complete. That’s a great way to get players to engage with your app daily and keep them involved with your app. But how do you implement them? Learn a couple of ways of approaching the task in this thread. Do you have a particular forum thread that was helpful for you? Let us know about it! Email [email protected], 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.
March 22, 2018
No audio available for this episode
HTML5 opens up some great opportunities for developers and one of those is plugin development using JavaScript. While most Corona developers will only use Lua in a cross-platform manner like they are currently using, it’s super easy to add JavaScript features to extend your app. You need two things: a .lua file that tests to see if your platform is HTML5 or some other platform and the actual JavaScript .js file. If you detect you are an HTML5 build, then you require the JavaScript plugin, else provide default functions that prevent those calls from creating errors for the non-HTML5 builds. Consider this code:-- -- myplugin.lua -- Copyright (c) 2018 Corona Labs Inc. All rights reserved. -- local lib local platform = system.getInfo("platform") if platform == 'html5' then -- use native JS plugin lib = require("myplugin_js") else -- wrapper for non web platforms local CoronaLibrary = require "CoronaLibrary" -- Create stub library for simulator lib = CoronaLibrary:new{ name='myplugin', publisherId='com.mydomainname' } -- Default implementations local function defaultFunction() print( "WARNING: The '" .. lib.name .. "' library is not available on this platform." ) end lib.set = defaultFunction lib.get = defaultFunction lib.addEventListener = defaultFunction end -- Return an instance return libIf you’re on HTML5, it includes the JavaScript plugin. If not, it simply lets the app know the function isn’t available. Plugins have to have a unique namespace and that’s accomplished by this line in the .lua file:lib = CoronaLibrary:new{ name='myplugin', publisherId='com.mydomainname' }Obviously if you intended to publish this to the Corona Marketplace, or if you want to use multiple plugins in your code, the name needs to be unique. Change “myplugin” to a proper name. Then set publisherId to the reverse domain name you use to publish with. For instance, Corona Labs made plugins would have a publisherId of “com.coronalabs“. Then you create a plugin with the same name except with an _js as part of the name. For instance if your plugin is “awesometimer.lua“, you would create “awesometimer_js.js“. This file will contain your JavaScript code. Here is an example:// // myplugin_js.js // Copyright (c) 2018 Corona Labs Inc. All rights reserved. // // JS plugin is an child object of 'window' window.myplugin_js = { // all the 1st-level functions are available to call from Lua // so 'get' and 'set' functions are available to call from Lua data:{}, // function may use up to 10 args; use Object or Array if you want to pass more than 10 args // arg maybe a Number, String, Boolean, Array or Object set: function(bool_arg, number_arg, string_arg, table_arg, array_arg) { console.log('js set() is called'); var data = window.myplugin_js.data; data.bool_arg = bool_arg; data.number_arg = number_arg; data.string_arg = string_arg; data.table_arg = table_arg; data.array_arg = array_arg; // Lua callback // you can pass to Lua a Number, String, Boolean, Array or Object args this.dispatchEvent({ name: 'onData', data: { arg1: bool_arg, arg2: number_arg, arg3: string_arg, arg4: table_arg, arg5: array_arg }}) console.log(typeof(bool_arg)); console.log(typeof(number_arg)); console.log(typeof(string_arg)); console.log(typeof(table_arg)); console.log(typeof(array_arg), array_arg.length); }, get: function() { var data = window.myplugin_js.data; console.log('js get() is called', data); return data; } }; console.log('myplugin_js is loaded');We of course can’t teach you JavaScript in this tutorial and there are plenty of examples on the Internet to see. The main point is that you add your plugin to the JavaScript window object, provide your functions as part of the plugin namespace and add your methods to your plugin object. Then in your .lua modules, i.e. main.lua, you can require the plugin and call the functions as necessary.-- -- main.lua -- Copyright (c) 2018 Corona Labs Inc. All rights reserved. -- -- A sample of using JS native plugin for Corona local widget = require( "widget" ) local json = require( "json" ) local myplugin = require("myplugin") local label = display.newText( "output", 50, 220, native.systemFont, 16 ) label.x = display.contentCenterX local data = native.newTextBox(160, 360, 320, 250) data.isEditable = false -- JS event listener. local function pluginListener( event ) local str = json.prettify(event) str = 'got event from JS plugin:\n' .. str print(str) data.text = str end local setData = function() -- call JS native plugin -- arg value maybe boolean, number, string, table -- local bool_arg = true local number_arg = 123 local string_arg = 'abc' local table_arg = {key1='key1value', key2={1,2,3}} local array_arg = {1,2,3,4,5,6,7} myplugin.set(bool_arg, number_arg, string_arg, table_arg, array_arg) end local getData = function() -- call JS native plugin local tbl = myplugin.get() if tbl then local str = json.prettify(tbl) -- Important: use index-debug.html if you want to see print output print('Data: ', str) data.text = str end end -- event listener, it's an option myplugin.addEventListener(pluginListener) widget.newButton { onRelease = setData, left=60, top=60, width=200, height=50, label = "Save Data in JS", labelColor = { default={ 1, 1, 1 }, over={ 0.6, 0.6, 0.6 } } } widget.newButton { onRelease = getData, left=60, top=120, width=200, height=50, label = "Read Saved Data", labelColor = { default={ 1, 1, 1 }, over={ 0.6, 0.6, 0.6 } } } --This example shows you how to call functions to get data, set data as well as dispatch events from JavaScript back to your Lua code. You can download the complete sample project from our GitHub repository. If you have questions please reach out on our HTML5 forum!
March 20, 2018
No audio available for this episode
Good news! Today Corona is pleased to announce that HTML5 builds are in “Open Beta”. That means starting with daily build 2018.3238, you can now have Corona output a folder with the various HTML files and content necessary to run your Corona game or app in a web browser. Simply upload the entire folder to your web server and access that folder through your HTML5 compatible browser. Due to JavaScript security restrictions, HTML5 builds only work if they are served from a web server. If you have Python installed you can test locally by starting a web browser on your computer and accessing your HTML5 build folder in your browser. The easiest way to get it served on macOS is to drag your build folder on to Terminal.app then paste python -m SimpleHTTPServer into the terminal window. Then open http://localhost:8000/index.html in you web browser. For Windows, with Python installed, run cmd.exe and then use the cd command to change directories to your build folder and run the same Python command and then open your browser to the above URL. If you need to see the console log, please open http://localhost:8000/index-debug.html instead. If your app makes calls to web servers, using API’s like network.request(), because of JavaScript cross-domain scripting rules, you can’t directly call REST type APIs. Instead you will need to write a local web script on the same domain that will make your REST API calls and then echo the returned data back to network.request(). We have opened a forum to discuss HTML5 builds. Please discuss your observations in the HTML5 forum. Because this is still a beta product, we don’t recommend releasing your game the public yet. If you do, you should heavily test your game or app before releasing it. HTML5 build behavior is subject to change as we continue to work to bring it to a release status. Most all current Corona-made and third-party plugins are not HTML5 compatible at this time. Many of our ad providers do not offer HTML5 SDK’s for us to build plugins against. Other plugins will take time for us to build HTML5 compatible versions where possible. For plugins in our Marketplace built by our community developers, it will be up to them to offer HTML5 plugins where possible or update existing plugins with HTML5 stubs where not possible. A tutorial on creating HTML5 plugins is coming soon. This is a huge milestone for Corona. It will open the door for you to reach more consumers. It will make it easier to show your work off to early testers, prospective clients and more. Even game jams will rock even more. Our goal is to get this out of beta by the next public release where we will be including some other great features. Please let us know your thoughts in our HTML5 forum.
March 10, 2018
No audio available for this episode
Welcome to this week’s From the Forum. In this post, we highlight a few Corona Community Forums posts that cover important topics. Physics and groups Groups are a wonderful way to organize your display objects but sometimes this can create issues for developers using physics. @roaminggamer and @horacebury contributed to a thread that explains the problem and offered up some solutions. Loading large scenes Doing tasks in Corona can take time. When you do many tasks in a row, your user interface will block. This can make loading large scenes appear as if your app has frozen. A standard tactic would be to show a progress bar. However, Lua is a single-threaded language that can make it difficult to avoid blocking and allow your progress bar to update. In this thread, several Corona developers jumped in and offered suggestions on how to manage loading a large number of assets. Making an accordion widget There are many different ways to present data to users. A popular web technique is an accordion style display where you click on an item and it expands to show more information. Building this in Corona can be a bit tricky since you need to know the height of other objects to move them around to open space for the added info. In this thread, our wonderful community of developers joined to solve the problem. Do you have a particular forum thread that was helpful for you? Let us know about it! Email [email protected], 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.
March 8, 2018
No audio available for this episode
We have made a change to our feedback site where feature requests are made. Before, you had 15 votes that you could spread among the items you felt were the most important to you. Now, vote limits are gone. When you click the “Vote” button, you will cast a single vote for the feature request. Clicking again will undo your vote. With this change, you can vote on any number of items. http://feedback.coronalabs.com
March 1, 2018
No audio available for this episode
Some of our Microsoft Windows customers who run a couple of virus/malware checking software have noticed that our installer was testing positive for a Other:Malware-gen [Trj] alert. Avast and AVG were flagging this. ESET and Fortinet reported a PUP or “potentially unwanted program” for a web-bar they detected. The other 51 virus tools reporting to virustotal.com gave Corona a clean bill of health. What was the cause of these? Corona’s installer included a file named dma.dll. This file was part of the DeskMetrics library, an analytics service we used to help collect crash reports. The dma.dll file is actually harmless, but to remove any doubt, we have removed this file from our Windows installer. This change goes live with daily build 2018.3226. If you’re concerned about the presence of this file in our installer, please update to 2018.3226 or later.
Feb. 26, 2018
No audio available for this episode
Welcome to this week’s From the Forum. In this post, we highlight a few Corona Community Forums posts that cover important topics. Glitches in Physics The original poster wanted to move an object around another like a moon orbiting a planet but the pivot joints were creating glitches in movement. Corona super programmer @davebollinger jumped in and provided some really great advice using various joint types to solve the problem in this thread. Cleaning up display objects Everyone wants to avoid memory leaks and make sure their app cleans up after itself. But how memory is released can be confusing. When are you required to nil an object? When does the system do it for you? What if it’s in a table? Multiple Corona developers jumped into this thread to clean up some misconceptions about cleaning up memory. More Rotation Another thread about orbiting: in this case, the poster was asking how to manage mass with the rotation and have potential escape velocity. @roaminggamer came to the rescue with some great examples including videos to help explain the process. Do you have a particular forum thread that was helpful for you? Let us know about it! Email [email protected], 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.
Feb. 21, 2018
No audio available for this episode
After a lot of hard work, Corona is happy to announce the release of the StartApp plugin! Now, app publishers who use the Corona framework to build their mobile applications will now be able to easily integrate StartApp’s SDK to monetize their Corona apps. StartApp is an insight-driven mobile technology company that enables partners to turn data into fulfilling mobile moments. By creating innovative ways of exploring mobile users’ intents and behaviors, and of being smarter about responding to these factors, we help our partners optimize and better execute their strategies. Corona is excited to now enable its developers to monetize using StartApp SDK, ranked as the 3rd most popular monetization SDK behind only AdMob and Facebook Audience Network, according to SDK analytics firm Mobbo with over 1 Billion MAUs, over 400,000 app partners. Not yet a using StartApp monetization plugin? Start using it now!

Podcasts like "Posts – Corona Labs"   ·   View all

By Lea Alcantara and Emily Lewis
Disclaimer: The podcast and artwork embedded on this page are from Corona Geek, which is the property of its owner and not affiliated with or endorsed by Listen Notes, Inc.