Changes for page 01 Lua Functions

Last modified by Theodore Xu on 2023/10/26 10:51

From version 5.5
edited by Stone Wu
on 2022/07/12 09:15
Change comment: There is no comment for this version
To version 5.10
edited by Stone Wu
on 2022/07/12 09:30
Change comment: (Autosaved)

Summary

Details

Page properties
Content
... ... @@ -1,4 +1,4 @@
1 -= **1 Interface Description** =
1 += **1 Interface description** =
2 2  
3 3  == **Data type definition** ==
4 4  
... ... @@ -92,24 +92,20 @@
92 92  1. From the print result, the first line and the second line are successfully called and returns true; the third line fails the call, the error message is translated as: the bar student has been registered, and there is indeed an error in the code.
93 93  1. The fourth line of code uses two variables to receive the return value. The call failed, the first variable stat is nil, and the second variable err stores the error message. Then print it out using print, which is the output of the third line. This example shows how to capture and view the error message.
94 94  
95 -== **Modification of the Print Function** ==
95 +== **Modification of print function** ==
96 96  
97 -For the convenience of remote development, the print data is sent to the front end (web page) by means of network transmission, and the user can see the result of the debug output, because it consumes certain data and occupies the bandwidth of the server (or occupies server resources). So make the following restrictions:
97 +For the convenience of remote development, the print data is sent to the front end (web page) by means of network transmission, and the user can see the result of the debug output, because it consumes certain data and occupies the bandwidth of the server (or occupies server resources). So the following restrictions are made.
98 98  
99 -**1.Interval limit: **When debugging, transfer once every 2~~3 seconds;
99 +1. **Interval limit: **When debugging, transfer once every 2~~3 seconds;
100 +1. **Data limit: **The transfer data cannot be larger than 1.5KB in a single transmission, otherwise the extra part will be ignored;
101 +1. **Transmission limit: **The data transmission will be stopped automatically after the debugging windows is not closed normally. Only when it is in the debugging window and the switch is on, there is data transmission;
100 100  
101 -**2.Data limit: **The transfer data cannot be larger than 1.5KB, and the extra part will be ignored;
102 -
103 -**3.Transmission limit: **The data transmission will be stopped automatically after the debugging windows is not closed normally. Only when it is in the debugging window and the switch is on, there is data transmission;
104 -
105 105  Users should pay attention to avoid printing a lot of useless information, should minimize the debug output
106 106  
107 107  In addition, please refer to the front-end documentation for how to use view debugging.
108 108  
109 109  (((
110 -= **2 Address Operation** =
111 -
112 -
108 += **2 Address operation** =
113 113  )))
114 114  
115 115  |=16-bit data formal|=HLword|=32-bit data formal|=HLword|= 64-bit data formal|=HLword
... ... @@ -142,20 +142,17 @@
142 142  43218765
143 143  )))|10
144 144  
145 -* If HLword enters any other value, it will be treated as invalid.
141 + Table 2-1
146 146  
147 - Demo:  Reads a 32-bit floating-point number at position D0 of PLC
143 +(% class="box errormessage" %)
144 +(((
145 +**✎Note: **If HLword enters any other value, it will be treated as invalid.
146 +)))
148 148  
148 +== **addr_getshort(string addr[, number type, number hlword])** ==
149 149  
150 +**Function:** Read 16-bit signed decimal address
150 150  
151 -[[image:企业微信截图_20210506180640.png||height="301" width="600" class="img-thumbnail"]]
152 -
153 -== **2.1 addr_getshort(string addr[, number type, number hlword])** ==
154 -
155 -**Function:**
156 -
157 -Read 16-bit signed decimal address
158 -
159 159  **Parameters:**
160 160  
161 161  //addr//: address
... ... @@ -173,13 +173,11 @@
173 173  Failed: multi
174 174  
175 175  (((
176 -== **2.2 addr_setshort(string addr, number num[, number type, number hlword])** ==
169 +== **addr_setshort(string addr, number num[, number type, number hlword])** ==
177 177  )))
178 178  
179 -**Function:**
172 +**Function:** Write 16-bit signed decimal address
180 180  
181 -Write 16-bit signed decimal address
182 -
183 183  **Parameters:**
184 184  
185 185  //addr//: address
... ... @@ -197,13 +197,11 @@
197 197  Failed: multi
198 198  
199 199  (((
200 -== **2.3 addr_getword(string addr[, number type, number hlword])** ==
191 +== **addr_getword(string addr[, number type, number hlword])** ==
201 201  )))
202 202  
203 -**Function:**
194 +**Function:** Read 16-bit unsigned decimal address
204 204  
205 -Read 16-bit unsigned decimal address
206 -
207 207  **Parameters:**
208 208  
209 209  //addr//: address
... ... @@ -219,13 +219,11 @@
219 219  Failed: multi
220 220  
221 221  (((
222 -== **2.4 addr_setword(string addr, number num[, number type, number hlword])** ==
211 +== **addr_setword(string addr, number num[, number type, number hlword])** ==
223 223  )))
224 224  
225 -**Function:**
214 +**Function:**Write 16-bit unsigned decimal address
226 226  
227 -Write 16-bit unsigned decimal address
228 -
229 229  **Parameters:**
230 230  
231 231  //addr//: address
... ... @@ -243,13 +243,11 @@
243 243  Failed: multi
244 244  
245 245  (((
246 -== **2.5 addr_getint(string addr[, number type, number hlword])** ==
233 +== **addr_getint(string addr[, number type, number hlword])** ==
247 247  )))
248 248  
249 -**Function:**
236 +**Function:** Read 32-bit signed decimal address
250 250  
251 -Read 32-bit signed decimal address
252 -
253 253  **Parameters:**
254 254  
255 255  //addr//: address
... ... @@ -265,13 +265,11 @@
265 265  Failed: multi
266 266  
267 267  (((
268 -== **2.6 addr_setint(string addr, number num[, number type, number hlword])** ==
253 +== **addr_setint(string addr, number num[, number type, number hlword])** ==
269 269  )))
270 270  
271 -**Function:**
256 +**Function:** Write 32-bit signed decimal address
272 272  
273 -Write 32-bit signed decimal address
274 -
275 275  **Parameters:**
276 276  
277 277  //addr//: address
... ... @@ -289,13 +289,11 @@
289 289  Failed: multi
290 290  
291 291  (((
292 -== **2.7 addr_getdword(string addr[, number type, number hlword])** ==
275 +== **addr_getdword(string addr[, number type, number hlword])** ==
293 293  )))
294 294  
295 -**Function:**
278 +**Function:** Read 32-bit unsigned decimal address
296 296  
297 -Read 32-bit unsigned decimal address
298 -
299 299  **Parameters:**
300 300  
301 301  //addr//: address
... ... @@ -311,13 +311,11 @@
311 311  Failed: multi
312 312  
313 313  (((
314 -== **2.8 addr_setdword(string addr, number num[, number type, number hlword])** ==
295 +== **addr_setdword(string addr, number num[, number type, number hlword])** ==
315 315  )))
316 316  
317 -**Function:**
298 +**Function:** Write 32-bit unsigned decimal address
318 318  
319 -Write 32-bit unsigned decimal address
320 -
321 321  **Parameters:**
322 322  
323 323  //addr//: address
... ... @@ -335,13 +335,11 @@
335 335  Failed: multi
336 336  
337 337  (((
338 -== **2.9 addr_getbit(string addr[, number type])** ==
317 +== **addr_getbit(string addr[, number type])** ==
339 339  )))
340 340  
341 -**Function:**
320 +**Function:** Read a bit of the register address
342 342  
343 -Read a bit of the register address
344 -
345 345  **Parameters:**
346 346  
347 347  //addr//: address
... ... @@ -357,13 +357,11 @@
357 357  Failed: multi
358 358  
359 359  (((
360 -== **2.10 addr_setbit(string addr, number num[, number type])** ==
337 +== **addr_setbit(string addr, number num[, number type])** ==
361 361  )))
362 362  
363 -**Function:**
340 +**Function:** Write a bit of the register address
364 364  
365 -Write a bit of the register address
366 -
367 367  **Parameters:**
368 368  
369 369  //addr//: address
... ... @@ -381,13 +381,11 @@
381 381  Failed: multi
382 382  
383 383  (((
384 -== **2.11 addr_getfloat(string addr[, number type, number hlword])** ==
359 +== **addr_getfloat(string addr[, number type, number hlword])** ==
385 385  )))
386 386  
387 -**Function:**
362 +**Function:** Read 32-bit floating address
388 388  
389 -Read 32-bit floating address
390 -
391 391  **Parameters:**
392 392  
393 393  //addr//: address
... ... @@ -403,13 +403,11 @@
403 403  Failed: multi
404 404  
405 405  (((
406 -== **2.12 addr_setfloat(string addr, number num[, number type, number hlword])** ==
379 +== **addr_setfloat(string addr, number num[, number type, number hlword])** ==
407 407  )))
408 408  
409 -**Function:**
382 +**Function:** Write 32-bit floating address
410 410  
411 -Write 32-bit floating address
412 -
413 413  **Parameters:**
414 414  
415 415  //addr//: address
... ... @@ -427,13 +427,11 @@
427 427  Failed: multi
428 428  
429 429  (((
430 -== **2.13 addr_getdouble(string addr[, number type, number hlword])** ==
401 +== **addr_getdouble(string addr[, number type, number hlword])** ==
431 431  )))
432 432  
433 -**Function:**
404 +**Function:** Read 64-bit floating address
434 434  
435 -Read 64-bit floating address
436 -
437 437  **Parameters:**
438 438  
439 439  //addr//: address
... ... @@ -449,13 +449,11 @@
449 449  Failed: multi
450 450  
451 451  (((
452 -== **2.14 addr_setdouble(string addr, number num[, number type, number hlword])** ==
421 +== **addr_setdouble(string addr, number num[, number type, number hlword])** ==
453 453  )))
454 454  
455 -**Function:**
424 +**Function:** Write 64-bit floating address
456 456  
457 -Write 64-bit floating address
458 -
459 459  **Parameters:**
460 460  
461 461  addr: address
... ... @@ -473,13 +473,11 @@
473 473  Failed: multi
474 474  
475 475  (((
476 -== **2.15 addr_getstring(string addr, number length[, number type, number hlbyte])** ==
443 +== **addr_getstring(string addr, number length[, number type, number hlbyte])** ==
477 477  )))
478 478  
479 -**Function:**
446 +**Function:** Read the specified length string from address
480 480  
481 -Read the specified length string from address
482 -
483 483  **Parameters:**
484 484  
485 485  //addr//: address
... ... @@ -497,13 +497,11 @@
497 497  Failed: multi
498 498  
499 499  (((
500 -== **2.16 addr_setstring(string addr, string str[, number type, number hlbyte])** ==
465 +== **addr_setstring(string addr, string str[, number type, number hlbyte])** ==
501 501  )))
502 502  
503 -**Function:**
468 +**Function:** Write the specified length string to address
504 504  
505 -Write the specified length string to address
506 -
507 507  **Parameters:**
508 508  
509 509  //addr//: address
... ... @@ -521,13 +521,11 @@
521 521  Failed: multi
522 522  
523 523  (((
524 -== **2.17 addr_bmov(string dst, string src, number length)** ==
487 +== **addr_bmov(string dst, string src, number length)** ==
525 525  )))
526 526  
527 -**Function:**
490 +**Function:** Copy data from source address to destination address
528 528  
529 -Copy data from source address to destination address
530 -
531 531  **Parameters:**
532 532  
533 533  //dst//: destination address
... ... @@ -543,13 +543,11 @@
543 543  **Failed: multi**
544 544  
545 545  (((
546 -== **2.18 addr_fill(string addr, number num, number length)** ==
507 +== **addr_fill(string addr, number num, number length)** ==
547 547  )))
548 548  
549 -**Function:**
510 +**Function:** Write the same value to consecutive addresses
550 550  
551 -Write the same value to consecutive addresses
552 -
553 553  **Parameters:**
554 554  
555 555  //addr//: address
... ... @@ -565,13 +565,11 @@
565 565  Failed: multi
566 566  
567 567  (((
568 -== **2.19 addr_newnoaddr(string addr, number offset)** ==
527 +== **addr_newnoaddr(string addr, number offset)** ==
569 569  )))
570 570  
571 -**Function:**
530 +**Function:** Offset address value relative to //addr//
572 572  
573 -Offset address value relative to //addr//
574 -
575 575  **Parameters:**
576 576  
577 577  //addr//: address
... ... @@ -585,13 +585,11 @@
585 585  Failed: multi
586 586  
587 587  (((
588 -== **2.20 addr_newstataddr(string addr, number offset)** ==
545 +== **addr_newstataddr(string addr, number offset)** ==
589 589  )))
590 590  
591 -**Function:**
548 +**Function:** Offset station number relative to //addr //station number
592 592  
593 -Offset station number relative to //addr //station number
594 -
595 595  **Parameters:**
596 596  
597 597  //addr//: address
... ... @@ -604,12 +604,10 @@
604 604  
605 605  Failed: multi
606 606  
607 -== **2.21 addr_gethex64(string addr[, number type, number hlword])** ==
562 +== **addr_gethex64(string addr[, number type, number hlword])** ==
608 608  
609 -**Function:**
564 +**Function:** Read 64-bit hexadecimal numbers
610 610  
611 -Read 64-bit hexadecimal numbers
612 -
613 613  **Parameters:**
614 614  
615 615  //addr//: address
... ... @@ -624,12 +624,10 @@
624 624  
625 625  Failed: multi
626 626  
627 -== **2.22 addr_sethex64(string addr, number num[, number type, number hlword])** ==
580 +== **addr_sethex64(string addr, number num[, number type, number hlword])** ==
628 628  
629 -**Function:**
582 +**Function:** Write 64-bit hexadecimal addresses
630 630  
631 -Write 64-bit hexadecimal addresses
632 -
633 633  **Parameters:**
634 634  
635 635  //addr//: address
... ... @@ -650,11 +650,11 @@
650 650  
651 651  Operations on the serial port such as read, write, etc. must use ':' for full mode calls, ie operations on an open serial object.
652 652  
653 -**Serial port name and mode:**
604 +**Serial port name and mode**
654 654  
655 655  The serial port configured in the communication configuration window cannot be configured again using the script. RS232 and RS458 (or RS422) can be used simultaneously, but RS422 and RS485 are mutually exclusive.For example, when the communication port is configured with COM1-485, the script can only open COM1-232, but not COM1-485/422. Similarly, when the communication port is configured with COM2-485, the script can only open COM2-232, but not COM2-485.
656 656  
657 -Attempting to use a script to open a serial port in an unsupported mode will result in an error directly, as below
608 +Attempting to use a script to open a serial port in an unsupported mode will result in an error directly, as below.
658 658  
659 659  |(((
660 660  local setup = {
... ... @@ -676,13 +676,11 @@
676 676  1. When the data bit is 8, the maximum value of data transmission is 255 (0xFF), which supports the transmission of any character.
677 677  
678 678  (((
679 -== **3.1 serial.open(table setup)** ==
630 +== **serial.open(table setup)** ==
680 680  )))
681 681  
682 -**Function:**
633 +**Function:** Enable one serial port
683 683  
684 -Enable one serial port
685 -
686 686  **Parameters:**
687 687  
688 688  //Setup// is a Lua table; it needs to contain the following fields
... ... @@ -716,17 +716,13 @@
716 716  Failed: multi
717 717  
718 718  (((
719 -== **3.2 serial.close(serial obj)** ==
668 +== **serial.close(serial obj)** ==
720 720  )))
721 721  
722 -**Function:**
671 +**Function:** Disable the serial port
723 723  
724 -Disable the serial port
673 +**Parameters: **//Obj //is the object returned by serial.open
725 725  
726 -**Parameters:**
727 -
728 -//Obj //is the object returned by serial.open
729 -
730 730  **Return:**
731 731  
732 732  Succeed: true
... ... @@ -734,13 +734,11 @@
734 734  Failed: multi
735 735  
736 736  (((
737 -== **3.3 serial:read(number bytes[, number timeout])** ==
682 +== **serial:read(number bytes[, number timeout])** ==
738 738  )))
739 739  
740 -**Function:**
685 +**Function:** Read the specified byte length serial port data
741 741  
742 -Read the specified byte length serial port data
743 -
744 744  **Parameters:**
745 745  
746 746  //bytes//: number of bytes
... ... @@ -754,15 +754,13 @@
754 754  Failed: multi
755 755  
756 756  (((
757 -== **3.4 serial:write(string data)** ==
700 +== **serial:write(string data)** ==
758 758  )))
759 759  
760 -**Function:**
703 +**Function:** Write the specified byte length to serial port data
761 761  
762 -Write the specified byte length to serial port data
705 +**Parameters: **
763 763  
764 -**Parameters:**
765 -
766 766  //data//: serial port data
767 767  
768 768  **Return:**
... ... @@ -772,13 +772,11 @@
772 772  Failed: multi
773 773  
774 774  (((
775 -== **3.5 serial:flush([number flag])** ==
716 +== **serial:flush([number flag])** ==
776 776  )))
777 777  
778 -**Function:**
719 +**Function:** Clear the serial port buffer
779 779  
780 -Clear the serial port buffer
781 -
782 782  **Parameters:**
783 783  
784 784  //[flag=2]// clear option: 0: read, 1: write, 2: read-write
... ... @@ -790,17 +790,13 @@
790 790  Failed: multi
791 791  
792 792  (((
793 -== **3.6 serial:close()** ==
732 +== **serial:close()** ==
794 794  )))
795 795  
796 -**Function:**
735 +**Function:** Close the serial port object
797 797  
798 -Close the serial port object
737 +**Parameters:** None
799 799  
800 -**Parameters:**
801 -
802 -None
803 -
804 804  **Return:**
805 805  
806 806  Succeed: true
... ... @@ -817,12 +817,10 @@
817 817  
818 818  **QoS value:**
819 819  
820 -0: Only push messages once, messages may be lost or duplicated. It can be used for environmental sensor data, it doesn't matter if lose a record, because there will be a second push message soon. This method is mainly used for normal APP push, but if the user smart device is not connected when the message is pushed, the message will be discarded, and the smart device will not be received when it is networked again.
755 +* 0: Only push messages once, messages may be lost or duplicated. It can be used for environmental sensor data, it doesn't matter if lose a record, because there will be a second push message soon. This method is mainly used for normal APP push, but if the user smart device is not connected when the message is pushed, the message will be discarded, and the smart device will not be received when it is networked again.
756 +* 1: The message is delivered at least once, but the message may be delivered repeatedly.
757 +* 2: The message was delivered exactly once. This level can be used in a billing system. In a billing system, repeated or missing messages can lead to incorrect results. This highest quality message push service can also be used for instant messaging APP pushes, ensuring that users only receive messages once.
821 821  
822 -1: The message is delivered at least once, but the message may be delivered repeatedly.
823 -
824 -2: The message was delivered exactly once. This level can be used in a billing system. In a billing system, repeated or missing messages can lead to incorrect results. This highest quality message push service can also be used for instant messaging APP pushes, ensuring that users only receive messages once.
825 -
826 826  **Retain flag:**
827 827  
828 828  0: not reserved;
... ... @@ -830,13 +830,11 @@
830 830  1: reserved
831 831  
832 832  (((
833 -== **4.1 mqtt.create(string serverurl, string clientid)** ==
766 +== **mqtt.create(string serverurl, string clientid)** ==
834 834  )))
835 835  
836 -**Function:**
769 +**Function:** Create an MQTT object
837 837  
838 -Create an MQTT object
839 -
840 840  **Parameters:**
841 841  
842 842  //serverurl //Server url
... ... @@ -858,17 +858,13 @@
858 858  Failed: multi
859 859  
860 860  (((
861 -== **4.2 mqtt.close(mqtt obj)** ==
792 +== **mqtt.close(mqtt obj)** ==
862 862  )))
863 863  
864 -**Function:**
795 +**Function:** Close the specified MQTT object (if the connected server will be disconnected automatically)
865 865  
866 -Close the specified MQTT object (if the connected server will be disconnected automatically)
797 +**Parameters: **//Obj //ithe objeced returned by mqtt.create
867 867  
868 -**Parameters:**
869 -
870 -//Obj //is the objeced returned by mqtt.create
871 -
872 872  **Return:**
873 873  
874 874  Succeed: true
... ... @@ -876,32 +876,25 @@
876 876  Failed: multi
877 877  
878 878  (((
879 -== **4.3 mqtt:connect(table conn[, table lwt, table cart])** ==
806 +== **mqtt:connect(table conn[, table lwt, table cart])** ==
880 880  )))
881 881  
882 -**Function:**
809 +**Function:**Establish a connection to the server
883 883  
884 -Establish a connection to the server
885 -
886 886  **Parameters:**
887 887  
888 888  //conn //is a Lua table and needs to contain the following fields
889 889  
890 -//string conn.username//, user name
815 +* //string conn.username//, user name
816 +* //string conn.password//, password
817 +* //number [conn.netway=0]//, networking method, if set error number will use Ethernet method
818 +** 0: Ethernet
819 +** 1: WIFI
820 +** 2: 4G
821 +** 3: 2G
822 +* //number [conn.keepalive=60]//, keep connected heartbeat interval, in seconds
823 +* //number [conn.cleansession=1]//, empty the session as described below:
891 891  
892 -//string conn.password//, password
893 -
894 -//number [conn.netway=0]//, networking method, if set error number will use Ethernet method
895 -
896 -* 0: Ethernet
897 -* 1: WIFI
898 -* 2: 4G
899 -* 3: 2G
900 -
901 -//number [conn.keepalive=60]//, keep connected heartbeat interval, in seconds
902 -
903 -//number [conn.cleansession=1]//, empty the session as described below:
904 -
905 905  This function is used to control the behavior when connecting and disconnecting, and the client and server will retain the session information. This information is used to guarantee "at least once" and "accurately once" delivery, as well as the subject of the client subscription, the user can choose to keep or ignore the session message, set as follows:
906 906  
907 907  * 1 (Empty): If a session exists and is 1, the previous session messages on the client and server are emptied.
... ... @@ -909,14 +909,11 @@
909 909  
910 910  //lwt// (Last Will and Testament) is a Lua table and needs to contain the following fields
911 911  
912 -//string lwt.topic//, topic
832 +* //string lwt.topic//, topic
833 +* //string lwt.message//, message
834 +* //number [lwt.qos=0]//, qos value
835 +* //number [lwt.retain=0]//, retain flag
913 913  
914 -//string lwt.message//, message
915 -
916 -//number [lwt.qos=0]//, qos value
917 -
918 -//number [lwt.retain=0]//, retain flag
919 -
920 920  **Return:**
921 921  
922 922  Succeed: true
... ... @@ -924,17 +924,13 @@
924 924  Failed: multi
925 925  
926 926  (((
927 -== **4.4 mqtt:disconnect([number timeout])** ==
844 +== **mqtt:disconnect([number timeout])** ==
928 928  )))
929 929  
930 -**Function:**
847 +**Function:** Disconnect from the MQTT server
931 931  
932 -Disconnect from the MQTT server
849 +**Parameters: **//[timeout=10000] //Disconnect waiting timeout, in milliseconds
933 933  
934 -**Parameters:**
935 -
936 -//[timeout=10000] //Disconnect waiting timeout, in milliseconds
937 -
938 938  **Return:**
939 939  
940 940  Succeed: true
... ... @@ -942,17 +942,13 @@
942 942  Failed: multi
943 943  
944 944  (((
945 -== **4.5 mqtt:isconnected()** ==
858 +== **mqtt:isconnected()** ==
946 946  )))
947 947  
948 -**Function:**
861 +**Function:** Test whether or not a client is currently connected to the MQTT server
949 949  
950 -Test whether or not a client is currently connected to the MQTT server
863 +**Parameters:** None
951 951  
952 -**Parameters:**
953 -
954 -None
955 -
956 956  **Return:**
957 957  
958 958  Succeed: true ~-~-Connected
... ... @@ -960,13 +960,11 @@
960 960  Failed: false ~-~- Unconnected and other unknowns
961 961  
962 962  (((
963 -== **4.6 mqtt:subscribe(string topic, number qos)** ==
872 +== **mqtt:subscribe(string topic, number qos)** ==
964 964  )))
965 965  
966 -**Function:**
875 +**Function: **Subscribe to the topic (before the subscription, the user must first call the connect method to connect to the server)
967 967  
968 -Subscribe to the topic (before the subscription, the user must first call the connect method to connect to the server)
969 -
970 970  **Parameters:**
971 971  
972 972  //topic//, topic name
... ... @@ -980,13 +980,11 @@
980 980  Failed: multi
981 981  
982 982  (((
983 -== **4.7 mqtt:unsubscribe(string topic)** ==
890 +== **mqtt:unsubscribe(string topic)** ==
984 984  )))
985 985  
986 -**Function:**
893 +**Function:** Unsubscribe topic
987 987  
988 -Unsubscribe topic
989 -
990 990  **Parameters:**
991 991  
992 992  //topic//, topic name
... ... @@ -998,13 +998,11 @@
998 998  Failed: multi
999 999  
1000 1000  (((
1001 -== **4.8 mqtt:publish(string topic, string message, number qos, number retain[, number timeout])** ==
906 +== **mqtt:publish(string topic, string message, number qos, number retain[, number timeout])** ==
1002 1002  )))
1003 1003  
1004 -**Function:**
909 +**Function:** Publish message
1005 1005  
1006 -Publish message
1007 -
1008 1008  **Parameters:**
1009 1009  
1010 1010  //topic//, topic name
... ... @@ -1024,17 +1024,13 @@
1024 1024  Failed: multi
1025 1025  
1026 1026  (((
1027 -== **4.9 mqtt:close()** ==
930 +== **mqtt:close()** ==
1028 1028  )))
1029 1029  
1030 -**Function:**
933 +**Function:** Close the mqtt object (the connection to the server will be automatically disconnected)
1031 1031  
1032 -Close the mqtt object (the connection to the server will be automatically disconnected)
935 +**Parameters:** None
1033 1033  
1034 -**Parameters:**
1035 -
1036 -None
1037 -
1038 1038  **Return:**
1039 1039  
1040 1040  Succeed: true
... ... @@ -1042,13 +1042,11 @@
1042 1042  Failed: multi
1043 1043  
1044 1044  (((
1045 -== **4.10 mqtt:on(string method, function callback)** ==
944 +== **mqtt:on(string method, function callback)** ==
1046 1046  )))
1047 1047  
1048 -**Function:**
947 +**Function:** Register event callback function
1049 1049  
1050 -Register event callback function
1051 -
1052 1052  **Parameters:**
1053 1053  
1054 1054  //method//, It can be message/arrived/offline, these 3 types of events