欢迎图片

Changes for page Lua Script

Last modified by Devin Chen on 2025/11/10 16:04

From version 4.1
edited by xingzhi lin
on 2025/09/24 10:38
Change comment: There is no comment for this version
To version 9.2
edited by xingzhi lin
on 2025/10/31 11:54
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -591,7 +591,7 @@
591 591  * type(number):type,type=1 is write-through
592 592  * element4:element
593 593  
594 -|(% style="width:203px" %)Value|(% style="width:967px" %)Describe
594 +|=(% style="width: 203px;" %)Value|=(% style="width: 967px;" %)Describe
595 595  |(% style="width:203px" %)0|(% style="width:967px" %)Default
596 596  |(% style="width:203px" %)1|(% style="width:967px" %)Forced prohibition of the use of the high-order function
597 597  |(% style="width:203px" %)2|(% style="width:967px" %)Enable high and low character swapping
... ... @@ -608,12 +608,18 @@
608 608  
609 609  * element5:element
610 610  
611 +|=(% style="width: 203px;" %)Value|=(% style="width: 967px;" %)Describe
612 +|(% style="width:203px" %)0|(% style="width:967px" %)Default
613 +|(% style="width:203px" %)4|(% style="width:967px" %)Gbk text, normal setting
614 +|(% style="width:203px" %)5|(% style="width:967px" %)Gbk text, the first byte is the string length
615 +|(% style="width:203px" %)12|(% style="width:967px" %)Unicode text
611 611  
612 -
613 613  * element6:element
614 614  
619 +|=(% style="width: 203px;" %)Value|=(% style="width: 967px;" %)Describe
620 +|(% style="width:203px" %)0|(% style="width:967px" %)Default
621 +|(% style="width:203px" %)11|(% style="width:967px" %)Characters are stored in one word
615 615  
616 -
617 617  Return:
618 618  
619 619  * Success: the designated length of the string
... ... @@ -622,12 +622,12 @@
622 622  Example:
623 623  
624 624  {{code language="Lua"}}
625 -print(we_bas_getstring("@W_HDW0", 10))
631 +print(we_bas_getstring("@W_HDW0", 10,0,0,0,0))
626 626  {{/code}}
627 627  
628 628  == [[we_bas_setstring>>||anchor="HAddressclass"]] ==
629 629  
630 -Prototype: we_bas_setstring(address, str [, len])
636 +Prototype: we_bas_setstring(address, str [, len, type, element4, element5, element6])
631 631  
632 632  Function: Write string
633 633  
... ... @@ -636,7 +636,37 @@
636 636  * address(string):address
637 637  * str(string):string
638 638  * len(number):length, if not set, it will be the bytes of the string
645 +* element4:element
639 639  
647 +|=(% style="width: 203px;" %)Value|=(% style="width: 967px;" %)Describe
648 +|(% style="width:203px" %)0|(% style="width:967px" %)Default
649 +|(% style="width:203px" %)1|(% style="width:967px" %)Forced prohibition of the use of the high-order function
650 +|(% style="width:203px" %)2|(% style="width:967px" %)Enable high and low character swapping
651 +|(% style="width:203px" %)3|(% style="width:967px" %)Enable high and low byte swapping
652 +|(% style="width:203px" %)4|(% style="width:967px" %)Gbk text, normal setting
653 +|(% style="width:203px" %)5|(% style="width:967px" %)Gbk text, the first byte is the string length
654 +|(% style="width:203px" %)6|(% style="width:967px" %)Endian-reversed type1: 12345678 -> 87654321
655 +|(% style="width:203px" %)7|(% style="width:967px" %)Endian-reversed type2: 12345678 -> 78563412
656 +|(% style="width:203px" %)8|(% style="width:967px" %)Endian-reversed type3: 12345678 -> 56781234
657 +|(% style="width:203px" %)9|(% style="width:967px" %)Endian-reversed type4: 12345678 -> 65872143
658 +|(% style="width:203px" %)10|(% style="width:967px" %)Endian-reversed type5: 12345678 -> 43218765
659 +|(% style="width:203px" %)11|(% style="width:967px" %)Characters are stored in one word
660 +|(% style="width:203px" %)12|(% style="width:967px" %)Unicode text
661 +
662 +* element5:element
663 +
664 +|=(% style="width: 203px;" %)Value|=(% style="width: 967px;" %)Describe
665 +|(% style="width:203px" %)0|(% style="width:967px" %)Default
666 +|(% style="width:203px" %)4|(% style="width:967px" %)Gbk text, normal setting
667 +|(% style="width:203px" %)5|(% style="width:967px" %)Gbk text, the first byte is the string length
668 +|(% style="width:203px" %)12|(% style="width:967px" %)Unicode text
669 +
670 +* element6:element
671 +
672 +|=(% style="width: 203px;" %)Value|=(% style="width: 967px;" %)Describe
673 +|(% style="width:203px" %)0|(% style="width:967px" %)Default
674 +|(% style="width:203px" %)11|(% style="width:967px" %)Characters are stored in one word
675 +
640 640  Return:
641 641  
642 642  * Success: true
... ... @@ -646,7 +646,7 @@
646 646  
647 647  {{code language="Lua"}}
648 648  local str = "Hello"
649 -we_bas_setstring("@W_HDW0", str)
685 +we_bas_setstring("@W_HDW0", str, 10, 0, 0, 0, 0)
650 650  {{/code}}
651 651  
652 652  == [[we_bas_bmov>>||anchor="HAddressclass"]] ==
... ... @@ -7807,6 +7807,231 @@
7807 7807  |crc16_arc|0x8005|0x0000|0x0000|true|true|123456789|0xBB3D
7808 7808  |crc32|0x04C11DB7|0xFFFFFFF|0xFFFFFFF|true|true|123456789|0xCBF43926
7809 7809  
7846 += LuaUserSecure =
7847 +
7848 +== user_secure.usersecure_getInfo ==
7849 +
7850 +**Prototype : **user_secure.usersecure_getInfo()
7851 +
7852 +**Function: **Get all user information
7853 +
7854 +**Return: **
7855 +
7856 +* Success: User data table
7857 +* Failure: Returns nil
7858 +
7859 +**Example**
7860 +
7861 +{{code language="LUA"}}
7862 +secure = user_secure.usersecure_getInfo()
7863 + for index,j in pairs(secure) do
7864 + for msg,value in pairs(j) do
7865 + if "permission" == msg then
7866 + print("index",index,"msg",msg,"value",table.concat(value,','))
7867 + else
7868 + print("index",index,"msg",msg,"value",value)
7869 + end
7870 +
7871 + end
7872 + end
7873 +
7874 +{{/code}}
7875 +
7876 +== user_secure.usersecure_addInfo ==
7877 +
7878 +**Prototype : **user_secure.usersecure_addInfo(username, password, supassword, desc, hide, permission)
7879 +
7880 +**Function: **Add user information
7881 +
7882 +**Parameters**:
7883 +
7884 +* username(string): New username (16 characters)
7885 +* password(string): Password (8 characters)
7886 +* supassword(string): Confirm password (8 characters)
7887 +* desc(string): Description (10 characters)
7888 +* hide(bool): Controls hiding; true: hide if insufficient permissions
7889 +* permission(table): Permissions; 1 for granted permissions, 0 for no permissions
7890 +
7891 +**Return: **
7892 +
7893 +* Success: Return 0
7894 +* Failure: Returns nil
7895 +
7896 +**Example**
7897 +
7898 +{{code language="LUA"}}
7899 +tab = {0,1,1,1,1,1,1,1,1,1,1,1}
7900 +user_secure.usersecure_addInfo("user1","123","123","user1",false,"tab")
7901 +{{/code}}
7902 +
7903 +== user_secure.usersecure_deleteInfo ==
7904 +
7905 +**Prototype : **user_secure.usersecure_deleteInfo(username)
7906 +
7907 +**Function: **Delete user information
7908 +
7909 +**Parameters**:
7910 +
7911 +* username
7912 +
7913 +**Return: **
7914 +
7915 +* Failure: Returns nil
7916 +
7917 +**Example**
7918 +
7919 +{{code language="LUA"}}
7920 +ret, msg = user_secure.usersecure_deleteInfo("user1")
7921 +{{/code}}
7922 +
7923 +== user_secure.usersecure_updatepermission ==
7924 +
7925 +**Prototype : **user_secure.usersecure_updatepermission(username, permission)
7926 +
7927 +**Function: **Modify permissions
7928 +
7929 +**Parameters**:
7930 +
7931 +* username
7932 +* permission(table): Permissions; 1 for granted permissions, 0 for no permissions
7933 +
7934 +**Return: **
7935 +
7936 +* Failure: Returns nil
7937 +
7938 +**Example**
7939 +
7940 +{{code language="LUA"}}
7941 +tab = {0,1,1,1,1,1,1,1,1,1,1,1}
7942 +ret, msg =user_secure.usersecure_updatepermission("user1","tab")
7943 +{{/code}}
7944 +
7945 +== user_secure.usersecure_login ==
7946 +
7947 +**Prototype : **user_secure.usersecure_login(username,pwd)
7948 +
7949 +**Function: **User login
7950 +
7951 +**Parameters**:
7952 +
7953 +* username
7954 +* pwd: password
7955 +
7956 +**Return: **
7957 +
7958 +* Failure: Returns nil
7959 +
7960 +**Example**
7961 +
7962 +{{code language="LUA"}}
7963 +ret, msg = user_secure.usersecure_login("user1", "123")
7964 +{{/code}}
7965 +
7966 +== user_secure.usersecure_logout ==
7967 +
7968 +**Prototype : **user_secure.usersecure_logout()
7969 +
7970 +**Function: **User logout
7971 +
7972 +**Return: **
7973 +
7974 +* Failure: Returns nil
7975 +
7976 +**Example**
7977 +
7978 +{{code language="LUA"}}
7979 +ret, msg = user_secure.usersecure_logout
7980 +{{/code}}
7981 +
7982 +== user_secure.usersecure_updatepwd ==
7983 +
7984 +**Prototype : **user_secure.usersecure_updatepwd (username, old, pwd, supwd)
7985 +
7986 +**Function: **Modify password
7987 +
7988 +**Parameters**:
7989 +
7990 +* username (string): Username, 16 characters
7991 +* old (string): Old password, 8 characters
7992 +* (((
7993 +pwd (string): New password, 8 characterssupwd (string): Confirm password, 8 characters
7994 +)))
7995 +
7996 +**Return: **
7997 +
7998 +* Success: CRC encrypted data
7999 +* Failure: Returns nil
8000 +
8001 +**Example**
8002 +
8003 +{{code language="LUA"}}
8004 +user_secure.usersecure_updatepwd("user1","123","321","321")
8005 +{{/code}}
8006 +
8007 += LuaChart =
8008 +
8009 +== chart.setAlarmBtnSpacing ==
8010 +
8011 +**Prototype : **chart.setAlarmBtnSpacing(partname, spacing)
8012 +
8013 +**Function: **Set the spacing between new alarm buttons
8014 +
8015 +**Parameters**:
8016 +
8017 +* (((
8018 +partname(string): Component name
8019 +)))
8020 +* (((
8021 +spacing(int): Button spacing (unit: px (pixels))
8022 +)))
8023 +
8024 +**Return: **
8025 +
8026 +* Success: User data table
8027 +* Failure: Returns nil
8028 +
8029 +**Example**
8030 +
8031 +{{code language="LUA"}}
8032 +chart.setAlarmBtnSpacing("1_ALM_0", 5)
8033 +{{/code}}
8034 +
8035 +== chart.setAlarmBtnScale ==
8036 +
8037 +
8038 +**Prototype : **chart.setAlarmBtnScale(partname, scale)
8039 +
8040 +**Function: **Set the new alarm button size scaling
8041 +
8042 +**Parameters**:
8043 +
8044 +* (((
8045 +partname(string): Component name
8046 +)))
8047 +* (((
8048 +scale(double): Scaling factor, default is 1, range [0.1, 5]
8049 +)))
8050 +
8051 +**Return: **
8052 +
8053 +* Success: True
8054 +* Failure: False
8055 +
8056 +**Example**
8057 +
8058 +{{code language="LUA"}}
8059 +chart.setAlarmBtnScale("1_ALM_0", 1.5)
8060 +{{/code}}
8061 +
8062 +
8063 +== chart.setFormulaBtnSpacing ==
8064 +
8065 +== chart.setFormulaBtnScale ==
8066 +
8067 +== chart.setBarChartBtnSpacing ==
8068 +
8069 +== chart.setBarChartBtnScale ==
8070 +
7810 7810  = Environment operation =
7811 7811  
7812 7812  (% class="wikigeneratedid" id="HGetsqliteenvironment" %)