#author("2025-04-17T07:54:51+00:00","default:yoya","yoya")
#author("2025-05-06T04:51:48+00:00","default:yoya","yoya")
#contents
- [[LuaJIT]]
- 欠点 ([[Lua/Defact]])
* 入門 [#d79a014a]
- Lua(ルア)でHello World!
-- http://simplesandsamples.com/hello.lua.html
- Luaスクリプト機能
-- https://www.rtpro.yamaha.co.jp/RT/docs/lua/tutorial/index.html
--- https://www.rtpro.yamaha.co.jp/RT/docs/lua/tutorial/library.html
- しぶしぶ覚えるLua言語
-- https://qiita.com/aike@github/items/2023bbeb21094af6795e
* sleep [#sleep]
- How to add a "sleep" or "wait" to my Lua Script?
-- https://stackoverflow.com/questions/17987618/how-to-add-a-sleep-or-wait-to-my-lua-script
local socket = require('socket')
socket.sleep(0.2)
coroutine.sleep(0.2)
* module [#k6dd5431]
- (Nvim) Lua for Javascripters: Module Exports
-- https://teukka.tech/posts/js-to-lua-modules/
local M = {} -
function M.deleteDataFile(name)
...
end
return M
* coroutine [#d3203ae1]
- luaのcoroutine
-- https://qiita.com/umisama/items/59f0cb706ea1ca7bb3ac
* class [#class]
Lua に class は存在しないので、それっぽいラッパー。
- Tylas11 / XivParty
-- https://github.com/Tylas11/XivParty/blob/master/classes.lua
-- https://github.com/Tylas11/XivParty/blob/master/player.lua
>
local player = classes.class()
>
function player:init(name, id, model)
>
self.name = name
* table [#table]
- [https://ja.wikibooks.org/wiki/Lua/%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB https://ja.wikibooks.org/wiki/Lua/テーブル]
- https://github.com/torch/xlua/blob/master/init.lua#L640
function table.splice(tbl, start, length)
length = length or 1
start = start or 1
local endd = start + length
local spliced = {}
local remainder = {}
for i,elt in ipairs(tbl) do
if i < start or i >= endd then
table.insert(spliced, elt)
else
table.insert(remainder, elt)
end
end
return spliced, remainder
end
* array [#array]
- Lua 配列(Array)
-- https://ooo.iiyudana.net/htm/lua_chp5frame.htm
local a = {}
a[1] = 0;
a[2] = 0;
a[100] = 0;
print( #a ) -- 2
print( table.getn( a ) ) -- 2
print( table.maxn( a ) )-- 100
* string [#lecef3d7]
- 文字列操作
-- https://inzkyk.xyz/lua_5_4/standard_libraries/string_manipulation/
string.find (s, pattern [, init [, plain]]) 検索
string.match (s, pattern [, init])
string.gmatch (s, pattern [, init]) グループ検索
string.gsub (s, pattern, repl [, n]) (リプレース)
*. [#fd4a2eed]
- 論理演算子を用いたLuaの慣用表現
-- https://qiita.com/hevo2/items/89d484c067466b24308c
-- Lua > 乱数を使う
--- http://simplesandsamples.com/rand.lua.html
- Lua > 乱数を使う
-- http://simplesandsamples.com/rand.lua.html
- 第2章 Lua言語の基礎
-- https://densan-labs.net/tech/lua/chapter2.html
--この部分が
--コメントと
--[[
この部分が
コメントとなります
]]
* 関連 [#rel]
- [[Windower/Lua]] ([[FF11]])