代码搜索:Lua
找到约 9,588 项符合「Lua」的源代码
代码结果 9,588
www.eeworm.com/read/192391/5157300
lua luac.lua
-- bare-bones luac in Lua
-- usage: lua luac.lua file.lua
assert(arg[1]~=nil and arg[2]==nil,"usage: lua luac.lua file.lua")
f=assert(io.open("luac.out","wb"))
f:write(string.dump(assert(loadfil
www.eeworm.com/read/192391/5157301
lua echo.lua
-- echo command line arguments
for i=0,table.getn(arg) do
print(i,arg[i])
end
www.eeworm.com/read/192391/5157302
lua sieve.lua
-- the sieve of of Eratosthenes programmed with coroutines
-- typical usage: lua -e N=1000 sieve.lua | column
-- generate all the numbers from 2 to n
function gen (n)
return coroutine.wrap(fun
www.eeworm.com/read/192391/5157303
lua xd.lua
-- hex dump
-- usage: lua xd.lua < file
local offset=0
while 1 do
local s=io.read(16)
if s==nil then return end
io.write(string.format("%08X ",offset))
string.gsub(s,"(.)",function (c)
www.eeworm.com/read/192391/5157304
lua cf.lua
-- temperature conversion table (celsius to farenheit)
for c0=-20,50-1,10 do
io.write("C ")
for c=c0,c0+10-1 do
io.write(string.format("%3.0f ",c))
end
io.write("\n")
io.write("F ")
www.eeworm.com/read/192391/5157305
lua factorial.lua
-- function closures are powerful
-- traditional fixed-point operator from functional programming
Y = function (g)
local a = function (f) return f(f) end
return a(function (f)
www.eeworm.com/read/192391/5157306
lua hello.lua
-- the first program in every language
io.write("Hello world, from ",_VERSION,"!\n")
www.eeworm.com/read/192391/5157307
lua sort.lua
-- two implementations of a sort function
-- this is an example only. Lua has now a built-in function "sort"
-- extracted from Programming Pearls, page 110
function qsort(x,l,u,f)
if l
www.eeworm.com/read/192080/5159989
lua monastery.lua
loadMappy( "monastery.pms", "monastery_out.tga" )
setStartBlock( 7, 29 )
addLevelTrigger( "", 7, 30, "forest_ghoul", 10, 13 )
addTextTrigger( "mapfound", 7, 29, "You use the map and\nfind your
www.eeworm.com/read/192080/5159990
lua forest.lua
loadMappy( "forest.pms", "monastery_out.tga" )
setStartBlock( 5, 24 )
addLevelTrigger( "", 6, 18, "cottage", 5, 7 )
addTextTrigger( "", 11, 12, "You dare not enter\nwithout instructions;\nyou w