本文共 2888 字,大约阅读时间需要 9 分钟。
需要一种简单的脚本语言来代替批处理,它需要足够小巧,同时功能上也应该足够强劲,自然选择了LUA语言。
print(‘Hello World’) print("Hello World")
C:\Windows\System32>luadistLuaDist-git 0.2.3 - Lua package manager for the LuaDist deployment system.Released under the MIT License. See https://github.com/luadist/luadist-gitUsage: luadist [DEPLOYMENT_DIRECTORY][ARGUMENTS...] [-VARIABLES...] Commands: help - print this help install - install modules remove - remove modules refresh - update information about modules in repositories list - list installed modules info - show information about modules search - search repositories for modules fetch - download modules make - manually deploy modules from local paths upload - upload installed modules to their repositories selftest - run the selftest of LuaDist To get help on specific command, run: luadist help C:\Windows\System32>
C:\Windows\System32>luaLua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio> print("Hello World")Hello World>
C:\Windows\System32>lua --helpusage: lua [options] [script [args]].Available options are: -e stat execute string 'stat' -l name require library 'name' -i enter interactive mode after executing 'script' -v show version information -- stop handling options - execute stdin and stop handling optionsC:\Windows\System32>lua -i test.lua
E:\MyDocument\Desktop\coding>lua -e "print('Hello World')"Hello WorldE:\MyDocument\Desktop\coding>
for i=0,#arg do print(arg[i])end
E:\MyDocument\Desktop\coding>lua test.lua "Hello" 1 2 3 4 5test.luaHello12345E:\MyDocument\Desktop\coding>arg[0]为文件的文件名