From 69a207af670279b7d5457430a0801f8ca8727521 Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Wed, 29 May 2019 12:59:23 -0700 Subject: [PATCH] more detail on library integration --- content/pong/ball/bouncing/library_integration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/pong/ball/bouncing/library_integration.md b/content/pong/ball/bouncing/library_integration.md index f39727a..a185847 100644 --- a/content/pong/ball/bouncing/library_integration.md +++ b/content/pong/ball/bouncing/library_integration.md @@ -10,9 +10,9 @@ Now we need to declare that library to TypeScript so we can use it in our game c If you'd like a very detailed description of declaration files and how they work, I recommend perusing the [official documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html). But I will give a specific use-case walkthrough here. -First, we need to find out which functions of the library we are actually going to use. If we look over the bump.lua documentation, we see that the library asks us to initialize a "world" using *bump.newWorld*, add rectangles to the world with *world:add*, and declare their movements using *world:move*. +First, we need to find out which functions of the library we are actually going to use. If we look over the bump.lua documentation, we see that the library asks us to initialize a "world" using *bump.newWorld*, add rectangles to the world with *world:add*, and declare their movements using *world:move*. We can also use *world:check* and *world:update* for finer control over the rectangles. -First, let's download _bump.lua_ and place it in the lua-lib folder. +First, let's download _bump.lua_ and place it in the lua-lib folder. This ensures that the library will be included in your game during the build process. In the lua-lib folder, let's create a new file: **lua-lib/bump.d.ts** @@ -48,7 +48,7 @@ export interface World { } ``` -In Lua, *table* is our generic object. All of our classes and other objects are translated to tables when using TSTL. +In Lua, *table* is our generic object. All of our classes and other objects are translated to tables when using TSTL, so it's a convenient type for generic objects. "add" is a pretty straightforward function: it takes a position and a width and height and adds that rectangle to the World.