浪語:修订间差异
跳转到导航
跳转到搜索
Lambda.cat(讨论 | 贡献) 无编辑摘要 |
Lambda.cat(讨论 | 贡献) 无编辑摘要 |
||
第46行: | 第46行: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <s> 測試姬 /baka yande.re 指令復現</s> (nsfw 警告) | ||
event[me,msg](u,m:"^/baka yande.re")=>$.get("https://yande.re/post.json?limit=1&page="+Math.floor(Math.random()*1e4),d=>drrr.dm(u,".",d[0].preview_url)) | <span style="color:black; background-color:black">event[me,msg](u,m:"^/baka yande.re")=>$.get("https://yande.re/post.json?limit=1&page="+Math.floor(Math.random()*1e4),d=>drrr.dm(u,".",d[0].preview_url))</span> | ||
基本的 +, -, *, / 運算子都有支援,+=, ++, -- 之類的也有,但目前不支援三元運算子。 | 基本的 +, -, *, / 運算子都有支援,+=, ++, -- 之類的也有,但目前不支援三元運算子。 | ||
第224行: | 第226行: | ||
<syntaxhighlight lang="javascript" line="1"> | <syntaxhighlight lang="javascript" line="1"> | ||
later 10000 print("hello world") | later 10000 print("hello world") | ||
// 注意以下 function 不會被呼叫 | |||
f = () => console.log("hello world") | |||
later 3000 f // 不會被呼叫,因為 f 被 auto lift,又被包了一層 function 在外面 | |||
later 3000 f() // 這樣才會在三秒後印出 hello world | |||
later 3000 () => console.log("hello world") // 但這個會正常運作 | |||
later 3000 console.log("hello world") // 這個也會正常運作 | |||
later 3000 { | |||
console.log("hello world") // 這個也會正常運作 | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
※ 注意 timer 和 later 會將 "非 lambda 的 expression" lift 成一個 lambda。 | |||
一些功能實作: | 一些功能實作: |