corona

How do I display array elements in Lua?

徘徊边缘 提交于 2019-12-08 02:50:15
问题 I'm having an issue displaying the elements of an array in Lua programming language. Basically, i created an array with 3 elements, and i'm trying to display its contents in a for loop on the corona sdk emulator. What happens is that if i display the individual array elements (without the loop), they display fine; as soon as I put them in a for loop, nothing shows up on the screen anymore this is my code: myText = {"hello", "world", "there"} for i = 1, myText do local myText = display.newText

avoiding collision in corona sdk

房东的猫 提交于 2019-12-07 19:21:28
问题 How to avoid collision between physics bodies in corona ? The application that I am developing makes use of many physics bodies.I want collision to happen between two desired bodies,but the collision is happening between all the bodies in the system.Can anyone help me with a solution? 回答1: There is the second method to assign a groupIndex to each object. The value can be a positive or negative integer, and is a simpler way of specifying collision rules: objects with the same positive

Display HTML data on a page : corona SDK

徘徊边缘 提交于 2019-12-07 16:47:31
问题 In one of my apps in corona, I have to display a html table in a scene. Is it possible to display a html table(whose html data string is generated within the app) on a normal page of corona sdk app..? Any advice is appreciable... 回答1: I think I understand what you are asking, and if so, then yes, of course you can! What you need to do is use the API for WebView. Note: Native web views are only supported on Android, iOS, the Corona Simulator for OS X, and OS X desktop apps. see documentation

Make two objects touchable which were created with a function (LUA, Corona)

ぃ、小莉子 提交于 2019-12-07 15:34:26
问题 I gues this is a real newbie question, but I have the following code: local function createCircle() [...] circle = display.newCircle( positionX, positionY, circleRadius ) [...] end function circle:touch( event ) if event.phase == "ended" then scaleCircle(self,scaleUp) end return true; end circle:addEventListener("touch", circle) I cleaned it up a bit, to concentrate on the important things. My problem right now is: I can touch one circle and scale it. But this works only for one of the

transition.to( ) doesn't work within a function and with a Runtime:addEventListener( “enterFrame”, method) listener in Corona / Lua

夙愿已清 提交于 2019-12-07 09:07:26
So here's my problem. I am working on some Lua code using Corona SDK, for an iPhone app. I have narrowed the problem down to a few lines of code, that, if made to work, can point me in the right direction for the actual code. ( Plus, posting the original code will only make this post longer :P). So here goes: local square = display.newRect( 0, 0, 100, 100 ) square:setFillColor( 255,255,255 ) local function move(event) transition.to( self, { time=1500, alpha=0, x=100, y=100 } ) end Runtime:addEventListener("enterFrame", move) Basically, the problem is that the transition.to( ) method does not

In Corona SDK how to add label(text) to images?

﹥>﹥吖頭↗ 提交于 2019-12-07 02:58:26
In corona SDK how to add label(text) to images I have created my image as follow local item = display.newImageRect('images/foo.png',70,70); item.x = 50; item.y = 50; How to add a text to the image? Many Thanks To add text to the image, so it appears to "stick" to the image, you could create the object (as you have) and also the text object directly above it. Then, create a group and stick them both in it. Here is an example of how that could be done: local myGroup = display.newGroup() local item = display.newImageRect('images/foo.png',70,70) item.x = 50 item.y = 50 local text = display.newText

Object assignment Lua

人走茶凉 提交于 2019-12-06 23:17:14
问题 I have a problem similar to this one: LUA and Corona error: Attempt To Call Method ' ' (A Nil Value) - Driving Me Crazy I have a TCell class: local TCell={}; local cell_mt = { __index=TCell }; function TCell.new(_contents_name,_x,_y) ... local ncell= { ... }; function ncell:setup() ... end ncell:setup(); return setmetatable(ncell,cell_mt); end return TCell; I have 2d array of TCell references called cells. When I assign cells[ind1][ind2]=cells[ind3][ind4] cells[ind1][ind2] begins to lose some

How do I display array elements in Lua?

◇◆丶佛笑我妖孽 提交于 2019-12-06 11:58:09
I'm having an issue displaying the elements of an array in Lua programming language. Basically, i created an array with 3 elements, and i'm trying to display its contents in a for loop on the corona sdk emulator. What happens is that if i display the individual array elements (without the loop), they display fine; as soon as I put them in a for loop, nothing shows up on the screen anymore this is my code: myText = {"hello", "world", "there"} for i = 1, myText do local myText = display.newText( myText[i], 0, 0, native.systemFont, 35 ) end fenadoruk Here is a function I wrote to list the items

Corona Runtime Error “attempt to concatenate field '?' (a nil value)”

↘锁芯ラ 提交于 2019-12-06 08:18:00
i have this 8 question survey in my mobile application handover project. At first the corona did not prompt me any error message and the app works just fine but when i add 2 more question to it i start getting this message error i am not sure why the error is "a nil value" but my code look something like this.(line 662 to 678) function checkEBASComplete() local tempScore = 0 for i = 1, 10 do print("EBAS:"..ebasRating_Arr[i]) tempScore = tempScore + ebasRating_Arr[i] if (ebasRating_Arr[i] == -1) then ebasScore = 0 ebasScore_text.text = "Test Incomplete" else ebasScore = tempScore ebasScore_text

avoiding collision in corona sdk

廉价感情. 提交于 2019-12-06 05:53:16
How to avoid collision between physics bodies in corona ? The application that I am developing makes use of many physics bodies.I want collision to happen between two desired bodies,but the collision is happening between all the bodies in the system.Can anyone help me with a solution? There is the second method to assign a groupIndex to each object. The value can be a positive or negative integer, and is a simpler way of specifying collision rules: objects with the same positive groupIndex value will always collide with each other, and objects with the same negative groupIndex value will never