Code:
local i1 = 1
print(i1)
local i2 = 1,0
print(i2)
local i3 = 1,
print(i3)
result:
1
1
nil
Why is i3 nil instead of 1?
Code:
local i1 = 1
print(i1)
local i2 = 1,0
print(i2)
local i3 = 1,
print(i3)
result:
1
1
nil
Why is i3 nil instead of 1?
with a few exceptions, Lua ignores spaces and newline characters. The original code can be represented as
local i3 = 1, and the print (i3)
assignment statement evaluates all its expressions before performing the assignment. So print before the assignment, but in the end i3 is assigned to 1.
local i3 = 1,
print (i3)-- nil
print (i3)-- 1
Previous: Is there any way for redux-saga to notify the view layer after asynchrony ends?
Next: Does websocket in tornado use celery the same as http server?
such as the question: how does idea on win support the creation of a project under a folder shared by samba under linux? ...
here I abstract the actual business I try to create a class that has the following methods: import types class A: def __init__(self,num): self.num = num self.add_prop(10) -sharp 10 def add_prop(self, n): f...
can nginx itself do that? It is better to use openresty ...
< H2 > describe my problem < H2 > system: debian 8.0x64 server: Openresty 1.13.6.1 default installation novice, the question is relatively simple, I beg your pardon problem description: I need to implement a unique match on request_uri (request p...
write content_by_lua_block in nginx to get output by direct curl access, and the web page access status is always in pending. ...
the lua script is simple: local current = redis.call( GET , KEYS[2]) if current == ARGV[2] then redis.call( SET , KEYS[1], ARGV[1]) return true end return false here is the java code: public static void main(String[] args) { ...
2018 05 17 22:35:44 [error] 54034-sharp0: *11 lua entry thread aborted: runtime error: usr local nginx modules ngx_metric_output.lua:3: module ngx_metric.counter not found: no field package.preload[ ngx_metric.counter ] no file m...
the library I use is luasql-mysql,. I found that there is no operation interface that supports prepare, so I wonder, in actual development, aren t developers afraid of sql injection? ...
nginx configuration file is as follows: nginx version: nginx 1.14.0 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix= etc nginx --sbin-path= usr sbin ...
is a path string to determine whether it is legal ? is the path may not actually exist , but the syntax of the path is correct . is not a function under os.path to check whether the path exists, but whether is legal . I have seen it before, bu...
...
the code is as follows: local ffi = require("ffi") ffi.cdef[[ struct timeval { long int tv_sec; long int tv_usec; }; int gettimeofday(struct timeval *tv, void *tz); ]]; local tm = ffi.new("struct timeval"...
lua-rectangle [master] ll total 32 -rw-r--r-- 1 zhangwei staff 15B 11 27 15:04 README.md -rw-r--r-- 1 zhangwei staff 352B 11 27 15:15 lua-rectangle-0.1-1.rockspec -rw-r--r-- 1 zhangwei staff 770B 11 27 15:15 lua-rectangle-0.1-1.src.rock -r...
the script is as follows: function main(splash, args) splash:go{ "http: www.taobao.com", headers={["User-Agent"]="Mozilla 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit 537.36 (KHTML, like Gecko) Chrome 71.0.3578.98 S...
I d like to ask why I run redis-cli through shell-- run lua script through eval, and pass parameters to nil. I did the same thing about commas separating spaces on the Internet, but I just couldn t get the parameters. I would like to ask all the bosse...
~ Desktop ip Python 3.6.7rc2 (v3.6.7rc2:4893861ab5, Oct 13 2018, 17:34:23) [MSC v.1900 64 bit (AMD64)] Type copyright , credits or license for more information IPython 7.2.0 -- An enhanced Interactive Python. Type ? for help. In [1]: ...
local f_1 = 1; local f_2 = 1; local sum = f_1 + f_2; for i = 1, 10 do print(sum) f_1 = f_2; f_2 = sum; sum = f_1 + f_2; end...
Happy New year, my friends! currently wants to configure a picture server, which can realize the following website picture server functions https: car2.autoimg.cn cardf..., that is, upload an image. You can generate the corresponding size image thro...
try: 1 0 print(1) except ZeroDivisionError: pass as above, I want print (1) to continue to run after ZeroDivisionError is triggered. it s not realistic to write two try. What if I have 100 print behind me? It s stupid to write 100 try. ...
demand use 301 to redirect Source address http: explore.gac.one aaa bbb variable destination address http: explore.gac.one -sharp transaction variable need to give a demonstration ...