I am using LuaSocket and http.request to call a remote PHP script that generates a Lua table and outputs it to the browser.
When I store the http.request response in a variable it’s a string, which renders the table unusable in my Lua code.
For example:
[lua]eventData = http.request(“http://www.example.com/events.php”)
print( eventData )
–print outputs this string from PHP, that is really a Lua table that PHP generated
months={
‘January’,
‘February’,
‘March’,
‘April’,
‘May’,
‘June’,
‘July’,
‘August’,
‘September’,
‘October’,
‘November’,
‘December’,
}[/lua]
If I try calling months[4], for example, it errors out with “attempt to index global ‘months’ (a nil value)”.
How can I cast that string as a usable table?
Thanks! [import]uid: 4621 topic_id: 1723 reply_id: 301723[/import]