Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I acccess value of returned result #57

Closed
the-papi opened this issue Mar 25, 2017 · 1 comment
Closed

How do I acccess value of returned result #57

the-papi opened this issue Mar 25, 2017 · 1 comment

Comments

@the-papi
Copy link

Hello,
at first sorry for this question... I am newbie in Lua.

When I use cjson.encode(res), I'll get something like this:

[{
	"id":	1,
	"col1":	"value1",
	"col2":	"value2",
	"col3":	null
}]

Can you tell me how can I get value of specific column?
I tried res[0].col2, res[0][col2], res[0]["col2"], but it doesn't work.

@the-papi
Copy link
Author

Solved. I don't understand why arrays in Lua start at 1.
Can be closed :)

@the-papi the-papi closed this as completed Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant