BIG PROJECT!! Need HELP!

I am working on a BIG project! The biggest one I have yet to make! It will be my first Corona Game but my experience with C and Objective-C makes it really easy to learn! I cant release any details yet but I have a few questions.


Question 1:

How do I make corona send an e-mail to specifically my e-mail.

Question 2:

How do I compile a LONG array into a string and separate the numbers by commas.

Question 3:

And how do I get the e-mail function to e-mail me the string?

If anyone can answer that would be much appreciated! The sooner this is done the sooner the game will be finished!
I really hope you all will like it! I should be releasing a video in the next few weeks.

-Gamexcb

[import]uid: 8517 topic_id: 3743 reply_id: 303743[/import]

1: you could use the http/ltn12 socket stuff to post to a server script (eg php) that actually sends the mail. you could send a “password” key from your corona app to your script to stop people just running your script by finding it on your site

2: see here http://lua-users.org/wiki/SplitJoin [lua]table.concat(myArray, “,”)[/lua] should do it

3: post this as the ltn12 source. see the twitter example in the included examples
[lua]local http = require(“socket.http”)
local ltn12 = require(“ltn12”)

– Create and send the tweet

tweetText = “Testing the latest Corona SDK for iPhone: http://bit.ly/CoronaSDK

– Function for URLencoding of message content
function escape (s)
s = string.gsub(s, “([&=+%c])”, function ©
return string.format("%%%02X", string.byte©)
end)
s = string.gsub(s, " ", “+”)
return s
end

function sendTweet()
local postBody = “status=” … escape( tweetText )
local headerTable = { [“Content-Type”] = “application/x-www-form-urlencoded”, [“Content-Length”] = string.len( postBody ) }

http.request {
url = “http://” … username … “:” … password … “@twitter.com/statuses/update.json”,
method = “POST”,
headers = headerTable,
source = ltn12.source.string( postBody )
}
print( “tweet sent!” )
end[/lua]

[import]uid: 6645 topic_id: 3743 reply_id: 11382[/import]

Thanks for the help!

I am actually not going to use the e-mail feature “in-game” i actually need it to develop my gameplay. I have made an app for personal use. In it i can create my “levels” and all the data is stored into two arrays. I want the app to when i’m done e-mail me the two arrays with commas in between each of the numbers. The arrays also HAVE to be kept separate. The arrays are interpreted by my game.

can i set a string to:

array1string = table.concat(myArray, “,”)

print(array1string)

will that give me the array with commas as separators?

The e-mail wold be directly sent to my g-mail without a server. The arrays are going to be very BIG so twitter won’t do.

Thank you again for all the help!

-Gamexcb

P.s - I barley understand all the code for servers and such :stuck_out_tongue:
[import]uid: 8517 topic_id: 3743 reply_id: 11508[/import]

>> can i set a string to: array1string = table.concat(myArray, “,”) print(array1string)

try it and see what it does! i don’t know i’m just passing on documentation :slight_smile:

but if you need to email yourself you will really need a server script… have you got access to php? you can install it on your own machine and talk to that from your phone on your local network. do you need it for mac or pc?
[import]uid: 6645 topic_id: 3743 reply_id: 11509[/import]

How would I go about setting up a php thingy?
I’m on a mac the editor would be on my iPhone.

Also is it possible to send a Facebook message? They already have a server. [import]uid: 8517 topic_id: 3743 reply_id: 11510[/import]

not tried on a mac but this is probably what you’d want
http://www.apachefriends.org/en/xampp-windows.html

it includes a local mailserver

then you should be able to do something like

main.lua[lua]array1string = escape(table.concat(myArray1,","))
array2string = escape(table.concat(myArray2,","))
local postbody = “array1=”…array1string…"&array2="…array2string
local headerTable = { [“Content-Type”] = “application/x-www-form-urlencoded”, [“Content-Length”] = string.len( postBody ) }

http.request {
url = “http://localhost/test/mailer.php”,
method = “POST”,
headers = headerTable,
source = ltn12.source.string( postBody )
}

etc[/lua]

mailer.php
[php]

<?php
$array1 = $\_REQUEST["array1"]; $array2 = $\_REQUEST["array2"]; // The message $message = "array1: ".$array1."\narray2: ".$array2; // Send mail('me@localhost', 'My Subject', $message); ?\> [/php] [import]uid: 6645 topic\_id: 3743 reply\_id: 11515[/import]