Skip to content

Commit 902e2e5

Browse files
committed
Update readme
1 parent dd06c48 commit 902e2e5

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

README.md

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
# Pythonized ComputerCraft API
22

3-
First, you need to start a server:
3+
1. Create module named `examplemod.py`:
44

5-
```bash
6-
cd your_folder_with_programs
7-
python -m computercraft.server
8-
```
5+
```python
6+
async def hello(api):
7+
await api.print('Hello world!')
8+
```
99

10-
Current directory is the place for your amazing programs.
11-
Server tracks files inside this directory and reloads if necessary.
12-
You don't (always) have to restart server if you change your programs.
10+
2. Start a server:
1311

14-
Create simple program named `hello.py`:
12+
```bash
13+
python -m computercraft.server examplemod
14+
```
1515

16-
```python
17-
async def program(api):
18-
await api.print('Hello world!')
19-
```
16+
3. In minecraft, open up any computer and type:
2017

21-
There must be a separate file for each program with `program` coroutine defined.
22-
23-
In minecraft, open up any computer and type:
24-
25-
```bash
26-
wget http://127.0.0.1:8080/ py
27-
py hello
28-
```
18+
```bash
19+
wget http://127.0.0.1:8080/ py
20+
py hello
21+
```
2922

3023
`py` is short Lua program that interacts with the server.
31-
Argument is the name of program without `.py`.
32-
In everything else it works exactly like native program on Lua.
24+
Argument is the name of coroutine inside the module.
3325
`api` object contains almost everything *as is* in ComputerCraft documentation:
3426

3527
```python

0 commit comments

Comments
 (0)