New to Openresty

42 views
Skip to first unread message

Saint Michael

unread,
Apr 17, 2021, 8:39:19 PM4/17/21
to openre...@googlegroups.com
I need to find any list of all the Openresty libraries that I can use 
as in 
local mysql = require "resty.mysql"
as well a general LUA programming boom as it applies to Openresty.  I already saw many generic videos about LUA.
For example, I cannot figure out how to obtain the same functionality of  "continue" in a loop, as found in every other language. I cannot figure out how can I call utility like awk or grep, etc, from inside Openresty-LUA, and send parameters, receive output to a variable. Also, I would like to find a library to convert a database result set to HTML where I can tell exactly how I want the conversion to be done.
Thanks in advance
Saint Michael

Joseph Mariadassou

unread,
Apr 18, 2021, 12:05:35 AM4/18/21
to openre...@googlegroups.com
Check out this site for a large list of lua libraries 

--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/CAC9cSOCM-9KgmWThMRvTcqN25CBv6zDXXrm%3DmwuZSHPCBXM_fw%40mail.gmail.com.

Saint Michael

unread,
Apr 18, 2021, 10:54:10 PM4/18/21
to openresty-en

I almost completed my project but for this issue
can somebody help me understand what am I doing wrong?

Kshitij Joshi

unread,
Apr 19, 2021, 10:52:01 AM4/19/21
to openresty-en
Use 
{*expression*} in your html template.

{*expression*} -> writes result of expression

Saint Michael

unread,
Apr 19, 2021, 8:38:28 PM4/19/21
to openresty-en
I am trying use this gsub
string:gsub(',',''):gsub("PRCT","%")
basically, I need to eliminate all commas from string and also replace "PRCT" for "%",
but the second part does not work.
What am I doing wrong?

Joseph Mariadassou

unread,
Apr 19, 2021, 8:59:47 PM4/19/21
to openre...@googlegroups.com
use %% when you need % as % is a marker 


Saint Michael

unread,
Apr 19, 2021, 9:19:25 PM4/19/21
to openre...@googlegroups.com
I must be blind where is the documentation for that?
What kind of information can I use on the right side?
Is it possible to combine both replacements in one?
Thanks in advance.

You received this message because you are subscribed to a topic in the Google Groups "openresty-en" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openresty-en/HeZV4nwiRaU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openresty-en...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/CAF8gy%2BX9BHH%3Dzt4hzBAULf1Bfd9ykpp_7-ArCurhiHrECJiiwQ%40mail.gmail.com.

Joseph Mariadassou

unread,
Apr 19, 2021, 9:41:16 PM4/19/21
to openre...@googlegroups.com
The Lua book (page 92) gives that info. But a quick google search yielded


I don't think you can combine them

Saint Michael

unread,
Apr 19, 2021, 10:43:16 PM4/19/21
to openre...@googlegroups.com
Can you give details about the Lua Book whose page 92 has this information?
There are many LUA books. I want to order the one.
Thanks in advance.
Philip


Saint Michael

unread,
Apr 20, 2021, 6:03:13 AM4/20/21
to openresty-en
Question: what library should I use for this: 
I want to retrieve a result set from my database, using resty.mysql, but then I need to convert it to an HTML table, as is, no changes, just get it and send it forward to the client.
What library should I use?
For example, I do a "select * from table", get the result into a variable, and need to convert it to <table>.....</table>.
Is this possible at all?

Thanks in advance

Aapo Talvensaari

unread,
Apr 20, 2021, 3:29:49 PM4/20/21
to openre...@googlegroups.com

Saint Michael

unread,
Apr 20, 2021, 3:37:24 PM4/20/21
to openre...@googlegroups.com
I am already using it, but as raw. 
I build my HTML table at the database. Suppose I don't do that and do an arbitrary select statement on any MySQL table, so I get from LUA:
res[1]["field1","field2"]...
how can translate that into a perfectly formed HTMAL table?
I use resty.mysql for the database
what do I have to add in the template?








Joseph Mariadassou

unread,
Apr 20, 2021, 5:23:31 PM4/20/21
to openre...@googlegroups.com

Joseph Mariadassou

unread,
Apr 20, 2021, 5:25:46 PM4/20/21
to openre...@googlegroups.com
The book I am referring to is by the original developers of Lua. A bit dense but a good reference 


On Tue, 20 Apr 2021 at 12:43 pm, Saint Michael <ven...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages