瀏覽代碼

Update: README

AnnulusGames 1 年之前
父節點
當前提交
0ee4777bea
共有 3 個文件被更改,包括 26 次插入14 次删除
  1. 13 7
      README.md
  2. 13 7
      README_JA.md
  3. 二進制
      docs/img1.png

+ 13 - 7
README.md

@@ -250,15 +250,21 @@ await state.DoFileAsync("sample.lua");
 ```lua
 -- sample.lua
 
--- The incremented value will be printed to the console every second
-local i = 0
-while true do
-    i = i + 1
-    print(i)
-    wait(1.0)
-end
+print "hello!"
+
+wait(1.0) -- wait 1 sec
+
+print "how are you?"
+
+wait(1.0) -- wait 1 sec
+
+print "goodbye!"
 ```
 
+This code can resume the execution of the Lua script after waiting with await, as shown in the following figure. This is very useful when writing scripts to be incorporated into games.
+
+![img](docs/img1.png)
+
 ## Coroutines
 
 Lua coroutines are represented by the `LuaThread` type.

+ 13 - 7
README_JA.md

@@ -250,15 +250,21 @@ await state.DoFileAsync("sample.lua");
 ```lua
 -- sample.lua
 
--- 1秒ごとにインクリメントされた値がコンソールに表示される
-local i = 0
-while true do
-    i = i + 1
-    print(i)
-    wait(1.0)
-end
+print "hello!"
+
+wait(1.0) -- 1秒待機する
+
+print "how are you?"
+
+wait(1.0) -- 1秒待機する
+
+print "goodbye!"
 ```
 
+このコードは以下の図のように、awaitで待機した後にLuaスクリプトの実行を再開することができます。これはゲームに組み込むスクリプトを記述する際などに非常に有用です。
+
+![img](docs/img1.png)
+
 ## コルーチン
 
 Luaのコルーチンは`LuaThread`型で表現されます。

二進制
docs/img1.png