Hi,
I am a newbie. I have a doubt. What should be the format of my web service response…xml/json/table…???
if i can have table, then is loadstring supported() in corona sdk???
[import]uid: 168398 topic_id: 30128 reply_id: 330128[/import]
Hi,
I’d recommend that you use JSON. Corona/Lua has very good support for JSON, which makes it super easy to use.
Essentially you can convert a JSON response into a Lua table just by “requiring” the JSON lib and then using json.decode().
You can read more here: http://docs.coronalabs.com/api/library/json/index.html
Ali [import]uid: 10499 topic_id: 30128 reply_id: 120631[/import]
hi…thanks for your reply…but i have never used JSON…
So…is it possible to use web service with XML/Lua table as output format???
if it is possible…then how can i use that XML response in my code…???
is loadstring() supported in corona SDK??? [import]uid: 168398 topic_id: 30128 reply_id: 120638[/import]
loadstring is not supported
But PHP has JSON library, so you could just convert PHP array to json, then download it, and as ahamidi said, decode it in Corona.
You can also use XML, but there is no XML lib in corona, but there are plenty of Lua XML readers, you can download and use. [import]uid: 41153 topic_id: 30128 reply_id: 120641[/import]
thank u so much ya… [import]uid: 168398 topic_id: 30128 reply_id: 120649[/import]
Hi,
I’d recommend that you use JSON. Corona/Lua has very good support for JSON, which makes it super easy to use.
Essentially you can convert a JSON response into a Lua table just by “requiring” the JSON lib and then using json.decode().
You can read more here: http://docs.coronalabs.com/api/library/json/index.html
Ali [import]uid: 10499 topic_id: 30128 reply_id: 120631[/import]
hi…thanks for your reply…but i have never used JSON…
So…is it possible to use web service with XML/Lua table as output format???
if it is possible…then how can i use that XML response in my code…???
is loadstring() supported in corona SDK??? [import]uid: 168398 topic_id: 30128 reply_id: 120638[/import]
loadstring is not supported
But PHP has JSON library, so you could just convert PHP array to json, then download it, and as ahamidi said, decode it in Corona.
You can also use XML, but there is no XML lib in corona, but there are plenty of Lua XML readers, you can download and use. [import]uid: 41153 topic_id: 30128 reply_id: 120641[/import]
thank u so much ya… [import]uid: 168398 topic_id: 30128 reply_id: 120649[/import]