corona

How to get the file size and delete file in Lua?

喜你入骨 提交于 2019-12-23 07:35:35
问题 I have problem in getting the size of the file using Lua. I am creating a function method that if the file size of the file is 743 bytes , then the file will be deleted. Here is my code : local getDLFile = function(fileToDL) local path = system.pathForFile(fileToDL, system.DocumentsDirectory ) local myFile = io.open( path, "w+b" ) http.request{ url = "http://www.testfile.com/"..fileToDL, sink = ltn12.sink.file(myFile), } -- i don't know what is the syntax if myFile.size == 743 bytes then

How to get the file size and delete file in Lua?

天涯浪子 提交于 2019-12-23 07:35:19
问题 I have problem in getting the size of the file using Lua. I am creating a function method that if the file size of the file is 743 bytes , then the file will be deleted. Here is my code : local getDLFile = function(fileToDL) local path = system.pathForFile(fileToDL, system.DocumentsDirectory ) local myFile = io.open( path, "w+b" ) http.request{ url = "http://www.testfile.com/"..fileToDL, sink = ltn12.sink.file(myFile), } -- i don't know what is the syntax if myFile.size == 743 bytes then

How to create, move and remove dynamic objects in corona sdk?

最后都变了- 提交于 2019-12-23 05:22:16
问题 I recently started programming with corona sdk to make a simple game. I need to create dynamic objects and when I move some object out it removes itself. I can create dynamic objects but I can't handle the events on each one. I want to do it all by functions. Here's a piece of my code and in last function ( myObject:touch ) I'd like to change it to a new function which will handle all objects not only myObject so I need to send object name as a parameter to that function. Would you please

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

和自甴很熟 提交于 2019-12-23 01:19:24
问题 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

Add 'fake' antialiasing to rotated rectangle

柔情痞子 提交于 2019-12-22 09:33:56
问题 I'm using Corona SDK, which fairly recently disabled antialiasing, without a way to re-enable it. I have several apps that use rotated rectangles and lines, and would like a way for to not look jagged. This image shows the difference: Is there a way to add some sort of antialiasing to these rectangles in Corona? I'd much prefer an antialias hack and be able to use new Corona features and fixes than use an old build with antialiasing.] Thanks! 回答1: You can use masks to your rects or images, it

Instagram “You Cannot Like this Media”

亡梦爱人 提交于 2019-12-22 04:04:51
问题 I am aware that the Instagram API was down a few hours ago, but it seems to be back up now. The problem is, when we post data to Instagram saying to like a specific photo, we get this error: {"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot like this media"}} We have gotten this error before, but we don't understand why we are getting it. Keep in mind, we logged into an alternate account which means that account hasn't even liked the media yet. If it helps at

middleclass problems

六眼飞鱼酱① 提交于 2019-12-21 20:48:16
问题 I'm using the LUA middleclass library now after some problems and I have a situation that I can't seem to figure out. Say I have my class: EDIT: Had a typo: here is the actual functions require "middleclass" weaponCanon2 = class("weaponCanon2") function weaponCanon2:onWeaponCollision(event) if (event.phase == "began") then if (event.other.name ~= "ground") then self.canonBall.inAir = false end end end function weaponCanon2:initialize(atX, atY, inGroup) self.name = "some value" self.someObject

Save highscore on corona sdk?

本小妞迷上赌 提交于 2019-12-20 07:10:07
问题 I want to save the highscore created in the game and can be seen in the main menu when the player hits the highscore button, can someone help me? 回答1: you can use SQLITE to save the highscore to database another way is make a file that write the score to a Text File and save it to the directory of the system 回答2: You can solve your problem in a easier way.. Just declare a Variable for the Score like this.. local score=0 Then Increment the score variable by 1 whenever it hits the paddle. So

PHP Login System Lua UPDATED CODE

吃可爱长大的小学妹 提交于 2019-12-20 06:03:28
问题 I am creating an app that requires the user to sign up/sign in and I couldn't hash the passwords because I was using the free version of 000webhost which allows 5.2 . So I switched my webhost and used the code from my website so I can hash the passwords . The register code works and hashes the passwords but the login code doesn't work and I've changed it multiple times . login.php : GLOBAL $username; GLOBAL $pw; GLOBAL $pw2; if(isset($_POST['Login'])) { $sql = "SELECT pw FROM users WHERE

corona coverting radio button to numeric textbox (lua)

余生颓废 提交于 2019-12-20 03:43:07
问题 I am trying to create a mobile application about healthcare. I have to create a survey like application to screen the patients. Right now i have completed a part of the survey using radio button, the other part also look something like this(see picture below) but i want the radio button change to numeric textbox. My application look something like this: Right now I want to convert the radio button to a numeric textbox. The question is: how can i make minimum code changes and replace all the