Skip to content

Commit 49937fb

Browse files
sjnamdoujiang24
authored andcommitted
doc: removed the useless semicolon in the example lua code
1 parent 83bfe91 commit 49937fb

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,9 +4207,9 @@ The header names are matched case-insensitively.
42074207
```lua
42084208

42094209
-- equivalent to ngx.header["Content-Type"] = 'text/plain'
4210-
ngx.header.content_type = 'text/plain';
4210+
ngx.header.content_type = 'text/plain'
42114211

4212-
ngx.header["X-My-Header"] = 'blah blah';
4212+
ngx.header["X-My-Header"] = 'blah blah'
42134213
```
42144214

42154215
Multi-value headers can be set this way:

doc/HttpLuaModule.wiki

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,14 +1123,14 @@ You can also initialize the [[#lua_shared_dict|lua_shared_dict]] shm storage at
11231123
lua_shared_dict dogs 1m;
11241124
11251125
init_by_lua_block {
1126-
local dogs = ngx.shared.dogs;
1126+
local dogs = ngx.shared.dogs
11271127
dogs:set("Tom", 56)
11281128
}
11291129
11301130
server {
11311131
location = /api {
11321132
content_by_lua_block {
1133-
local dogs = ngx.shared.dogs;
1133+
local dogs = ngx.shared.dogs
11341134
ngx.say(dogs:get("Tom"))
11351135
}
11361136
}
@@ -1351,8 +1351,8 @@ a time. However, a workaround is possible using the [[#ngx.var.VARIABLE|ngx.var.
13511351
local a = 32
13521352
local b = 56
13531353
1354-
ngx.var.diff = a - b; -- write to $diff directly
1355-
return a + b; -- return the $sum value normally
1354+
ngx.var.diff = a - b -- write to $diff directly
1355+
return a + b -- return the $sum value normally
13561356
';
13571357
13581358
echo "sum = $sum, diff = $diff";
@@ -1541,7 +1541,7 @@ The right way of doing this is as follows:
15411541
rewrite_by_lua '
15421542
ngx.var.b = tonumber(ngx.var.a) + 1
15431543
if tonumber(ngx.var.b) == 13 then
1544-
return ngx.redirect("/bar");
1544+
return ngx.redirect("/bar")
15451545
end
15461546
';
15471547
@@ -2824,7 +2824,7 @@ For example:
28242824
location /foo {
28252825
set $my_var ''; # this line is required to create $my_var at config time
28262826
content_by_lua_block {
2827-
ngx.var.my_var = 123;
2827+
ngx.var.my_var = 123
28282828
...
28292829
}
28302830
}
@@ -3247,7 +3247,7 @@ This option is set to <code>false</code> by default
32473247
set $dog 'hello';
32483248
content_by_lua_block {
32493249
res = ngx.location.capture("/other",
3250-
{ share_all_vars = true });
3250+
{ share_all_vars = true })
32513251
32523252
ngx.print(res.body)
32533253
ngx.say(ngx.var.uri, ": ", ngx.var.dog)
@@ -3311,7 +3311,7 @@ unescaping them in the Nginx config file.
33113311
set $cat '';
33123312
content_by_lua_block {
33133313
res = ngx.location.capture("/other",
3314-
{ vars = { dog = "hello", cat = 32 }});
3314+
{ vars = { dog = "hello", cat = 32 }})
33153315
33163316
ngx.print(res.body)
33173317
}
@@ -3338,8 +3338,8 @@ The <code>ctx</code> option can be used to specify a custom Lua table to serve a
33383338
local ctx = {}
33393339
res = ngx.location.capture("/sub", { ctx = ctx })
33403340
3341-
ngx.say(ctx.foo);
3342-
ngx.say(ngx.ctx.foo);
3341+
ngx.say(ctx.foo)
3342+
ngx.say(ngx.ctx.foo)
33433343
}
33443344
}
33453345
</geshi>
@@ -3356,13 +3356,13 @@ It is also possible to use this <code>ctx</code> option to share the same [[#ngx
33563356
<geshi lang="nginx">
33573357
location /sub {
33583358
content_by_lua_block {
3359-
ngx.ctx.foo = "bar";
3359+
ngx.ctx.foo = "bar"
33603360
}
33613361
}
33623362
location /lua {
33633363
content_by_lua_block {
33643364
res = ngx.location.capture("/sub", { ctx = ngx.ctx })
3365-
ngx.say(ngx.ctx.foo);
3365+
ngx.say(ngx.ctx.foo)
33663366
}
33673367
}
33683368
</geshi>
@@ -3486,9 +3486,9 @@ The header names are matched case-insensitively.
34863486
34873487
<geshi lang="lua">
34883488
-- equivalent to ngx.header["Content-Type"] = 'text/plain'
3489-
ngx.header.content_type = 'text/plain';
3489+
ngx.header.content_type = 'text/plain'
34903490
3491-
ngx.header["X-My-Header"] = 'blah blah';
3491+
ngx.header["X-My-Header"] = 'blah blah'
34923492
</geshi>
34933493
34943494
Multi-value headers can be set this way:
@@ -3521,13 +3521,13 @@ is equivalent to
35213521
Setting a slot to <code>nil</code> effectively removes it from the response headers:
35223522
35233523
<geshi lang="lua">
3524-
ngx.header["X-My-Header"] = nil;
3524+
ngx.header["X-My-Header"] = nil
35253525
</geshi>
35263526
35273527
The same applies to assigning an empty table:
35283528
35293529
<geshi lang="lua">
3530-
ngx.header["X-My-Header"] = {};
3530+
ngx.header["X-My-Header"] = {}
35313531
</geshi>
35323532
35333533
Setting <code>ngx.header.HEADER</code> after sending out response headers (either explicitly with [[#ngx.send_headers|ngx.send_headers]] or implicitly with [[#ngx.print|ngx.print]] and similar) will log an error message.
@@ -4403,8 +4403,8 @@ Does an internal redirect to <code>uri</code> with <code>args</code> and is simi
44034403
44044404
<geshi lang="lua">
44054405
ngx.exec('/some-location');
4406-
ngx.exec('/some-location', 'a=3&b=5&c=6');
4407-
ngx.exec('/some-location?a=3&b=5', 'c=6');
4406+
ngx.exec('/some-location', 'a=3&b=5&c=6')
4407+
ngx.exec('/some-location?a=3&b=5', 'c=6')
44084408
</geshi>
44094409
44104410
The optional second <code>args</code> can be used to specify extra URI query arguments, for example:
@@ -4430,7 +4430,7 @@ Named locations are also supported but the second <code>args</code> argument wil
44304430
<geshi lang="nginx">
44314431
location /foo {
44324432
content_by_lua_block {
4433-
ngx.exec("@bar", "a=goodbye");
4433+
ngx.exec("@bar", "a=goodbye")
44344434
}
44354435
}
44364436
@@ -4509,7 +4509,7 @@ This method is similar to the [[HttpRewriteModule#rewrite|rewrite]] directive wi
45094509
is equivalent to the following Lua code
45104510
45114511
<geshi lang="lua">
4512-
return ngx.redirect('/foo'); -- Lua code
4512+
return ngx.redirect('/foo') -- Lua code
45134513
</geshi>
45144514
45154515
while
@@ -7377,7 +7377,7 @@ For example, the following [[HttpSetMiscModule]] directives can be invoked this
73777377
For instance,
73787378
73797379
<geshi lang="lua">
7380-
local res = ndk.set_var.set_escape_uri('a/b');
7380+
local res = ndk.set_var.set_escape_uri('a/b')
73817381
-- now res == 'a%2fb'
73827382
</geshi>
73837383

0 commit comments

Comments
 (0)