打开/关闭菜单
Toggle preferences menu
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:Helloworld

来自医林拾薪
Cirno.9讨论 | 贡献2023年7月15日 (六) 03:33的版本 (创建页面,内容为“local p = {}; --All Lua modules on Wikipedia must begin by defining a variable --that will hold their externally accessible functions. --Such variables can have whatever name you want and may --also contain various data as well as functions. p.hello = function( frame ) --Add a function to "p". --Such functions are callable in Wikipedia…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

可在模块:Helloworld/doc创建此模块的帮助文档

脚本错误:Lua错误:无法创建进程:proc_open(/home/pi/LUA/error.log): Failed to open stream: 权限不够

local p = {};     --All Lua modules on Wikipedia must begin by defining a variable 
                    --that will hold their externally accessible functions.
                    --Such variables can have whatever name you want and may 
                    --also contain various data as well as functions.
p.hello = function( frame )     --Add a function to "p".  
                                        --Such functions are callable in Wikipedia
                                        --via the #invoke the command.
                                        --"frame" will contain the data that Wikipedia
                                        --sends this function when it runs. 
                                 -- 'Hello' is the name of your choice. The same name needs to be referred to when the module is used.
    
    local str = "Hello World!"  --Declare a local variable and set it equal to
                                --"Hello World!".  
    
    return str    --This tells us to quit this function and send the information in
                  --"str" back to Wikipedia.
    
end  -- end of the function "hello"