Browse Source

Update: README

AnnulusGames 1 year ago
parent
commit
0ee4777bea
3 changed files with 26 additions and 14 deletions
  1. 13 7
      README.md
  2. 13 7
      README_JA.md
  3. BIN
      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`型で表現されます。

BIN
docs/img1.png