Skip to content

Commit bdfc4bf

Browse files
sjnambob-floyd
and
bob-floyd
authored
doc: removed the useless semicolon in the example lua code (openresty#1757)
Co-authored-by: bob-floyd <[email protected]>
1 parent e526cae commit bdfc4bf

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

README.markdown

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,14 +1402,14 @@ You can also initialize the [lua_shared_dict](#lua_shared_dict) shm storage at t
14021402
lua_shared_dict dogs 1m;
14031403
14041404
init_by_lua_block {
1405-
local dogs = ngx.shared.dogs;
1405+
local dogs = ngx.shared.dogs
14061406
dogs:set("Tom", 56)
14071407
}
14081408
14091409
server {
14101410
location = /api {
14111411
content_by_lua_block {
1412-
local dogs = ngx.shared.dogs;
1412+
local dogs = ngx.shared.dogs
14131413
ngx.say(dogs:get("Tom"))
14141414
}
14151415
}
@@ -1659,8 +1659,8 @@ a time. However, a workaround is possible using the [ngx.var.VARIABLE](#ngxvarva
16591659
local a = 32
16601660
local b = 56
16611661
1662-
ngx.var.diff = a - b; -- write to $diff directly
1663-
return a + b; -- return the $sum value normally
1662+
ngx.var.diff = a - b -- write to $diff directly
1663+
return a + b -- return the $sum value normally
16641664
';
16651665
16661666
echo "sum = $sum, diff = $diff";
@@ -1874,7 +1874,7 @@ The right way of doing this is as follows:
18741874
rewrite_by_lua '
18751875
ngx.var.b = tonumber(ngx.var.a) + 1
18761876
if tonumber(ngx.var.b) == 13 then
1877-
return ngx.redirect("/bar");
1877+
return ngx.redirect("/bar")
18781878
end
18791879
';
18801880
@@ -3480,7 +3480,7 @@ For example:
34803480
location /foo {
34813481
set $my_var ''; # this line is required to create $my_var at config time
34823482
content_by_lua_block {
3483-
ngx.var.my_var = 123;
3483+
ngx.var.my_var = 123
34843484
...
34853485
}
34863486
}
@@ -3948,7 +3948,7 @@ This option is set to `false` by default
39483948
set $dog 'hello';
39493949
content_by_lua_block {
39503950
res = ngx.location.capture("/other",
3951-
{ share_all_vars = true });
3951+
{ share_all_vars = true })
39523952
39533953
ngx.print(res.body)
39543954
ngx.say(ngx.var.uri, ": ", ngx.var.dog)
@@ -3976,7 +3976,7 @@ The `copy_all_vars` option provides a copy of the parent request's Nginx variabl
39763976
set $dog 'hello';
39773977
content_by_lua_block {
39783978
res = ngx.location.capture("/other",
3979-
{ copy_all_vars = true });
3979+
{ copy_all_vars = true })
39803980
39813981
ngx.print(res.body)
39823982
ngx.say(ngx.var.uri, ": ", ngx.var.dog)
@@ -4014,7 +4014,7 @@ unescaping them in the Nginx config file.
40144014
set $cat '';
40154015
content_by_lua_block {
40164016
res = ngx.location.capture("/other",
4017-
{ vars = { dog = "hello", cat = 32 }});
4017+
{ vars = { dog = "hello", cat = 32 }})
40184018
40194019
ngx.print(res.body)
40204020
}
@@ -4042,8 +4042,8 @@ The `ctx` option can be used to specify a custom Lua table to serve as the [ngx.
40424042
local ctx = {}
40434043
res = ngx.location.capture("/sub", { ctx = ctx })
40444044
4045-
ngx.say(ctx.foo);
4046-
ngx.say(ngx.ctx.foo);
4045+
ngx.say(ctx.foo)
4046+
ngx.say(ngx.ctx.foo)
40474047
}
40484048
}
40494049
```
@@ -4061,13 +4061,13 @@ It is also possible to use this `ctx` option to share the same [ngx.ctx](#ngxctx
40614061
40624062
location /sub {
40634063
content_by_lua_block {
4064-
ngx.ctx.foo = "bar";
4064+
ngx.ctx.foo = "bar"
40654065
}
40664066
}
40674067
location /lua {
40684068
content_by_lua_block {
40694069
res = ngx.location.capture("/sub", { ctx = ngx.ctx })
4070-
ngx.say(ngx.ctx.foo);
4070+
ngx.say(ngx.ctx.foo)
40714071
}
40724072
}
40734073
```
@@ -4245,14 +4245,14 @@ Setting a slot to `nil` effectively removes it from the response headers:
42454245

42464246
```lua
42474247

4248-
ngx.header["X-My-Header"] = nil;
4248+
ngx.header["X-My-Header"] = nil
42494249
```
42504250

42514251
The same applies to assigning an empty table:
42524252

42534253
```lua
42544254

4255-
ngx.header["X-My-Header"] = {};
4255+
ngx.header["X-My-Header"] = {}
42564256
```
42574257

42584258
Setting `ngx.header.HEADER` after sending out response headers (either explicitly with [ngx.send_headers](#ngxsend_headers) or implicitly with [ngx.print](#ngxprint) and similar) will log an error message.
@@ -5254,9 +5254,9 @@ Does an internal redirect to `uri` with `args` and is similar to the [echo_exec]
52545254

52555255
```lua
52565256

5257-
ngx.exec('/some-location');
5258-
ngx.exec('/some-location', 'a=3&b=5&c=6');
5259-
ngx.exec('/some-location?a=3&b=5', 'c=6');
5257+
ngx.exec('/some-location')
5258+
ngx.exec('/some-location', 'a=3&b=5&c=6')
5259+
ngx.exec('/some-location?a=3&b=5', 'c=6')
52605260
```
52615261

52625262
The optional second `args` can be used to specify extra URI query arguments, for example:
@@ -5285,7 +5285,7 @@ Named locations are also supported but the second `args` argument will be ignore
52855285
52865286
location /foo {
52875287
content_by_lua_block {
5288-
ngx.exec("@bar", "a=goodbye");
5288+
ngx.exec("@bar", "a=goodbye")
52895289
}
52905290
}
52915291
@@ -5373,7 +5373,7 @@ is equivalent to the following Lua code
53735373

53745374
```lua
53755375

5376-
return ngx.redirect('/foo'); -- Lua code
5376+
return ngx.redirect('/foo') -- Lua code
53775377
```
53785378

53795379
while
@@ -8626,7 +8626,7 @@ For instance,
86268626

86278627
```lua
86288628

8629-
local res = ndk.set_var.set_escape_uri('a/b');
8629+
local res = ndk.set_var.set_escape_uri('a/b')
86308630
-- now res == 'a%2fb'
86318631
```
86328632

0 commit comments

Comments
 (0)