-
-
Notifications
You must be signed in to change notification settings - Fork 81
TutorialHelloWorld
This tutorial demonstrates
- how to setup a simple development environment
- write a program that output hello world
- explains the basic concept behind the scene
This article is an aggregates of information you will find in this wiki guide. Skip this tutorial, if you have already read all related pages.
For more information, see Install Guide.
- Download ParacraftSDK
- or you can clone it by running:
git clone https://github.com/LiXizhi/ParaCraftSDK.git
- Make sure you have updated to the latest version, by running
./redist/paracraft.exeat least once - Run
./NPLRuntime/install.bat- The NPL Runtime will be copied from
./redistfolder to./NPLRuntime/win/bin - The above path will be added to your %path% variable, so that you can run npl script from any folder.
- The NPL Runtime will be copied from
To write NPL code, we recommend using either or both of following editors (and plugins):
-
Visual Studio Community Edition: the free version of
visual studio- In visual studio, select
menu::Tools::Extensions, and search online fornplto install following plugins:
- In visual studio, select
- Visual Studio Code: a cross-platform free editor based on Atom
Under linux you need to compile from source code.
git clone https://github.com/LiXizhi/NPLRuntime.git
./build_linux.sh
One can also use ./npl_install.sh to install, which automatically download prerequisites.
Run in command line npl helloworld.lua.
The content of helloworld.lua is like this:
print("hello world")You should see a file ./log.txt in your current working directory, which contains the "hello world" text.
In linux, npl is installed to /usr/local/bin/npl if you installed it from source code.
Therefore, one can invoke standalone npl application like below.
Write helloworld.npl like below
#!/usr/local/bin/npl
print("hello world")
ParaGlobal.Exit(0)And then one can run the application with the command
./helloworld.npl
Please note only *.npl and *.lua file extension are supported.
Under Windows, the npl executable folder need to be added to search path. If npl command is not found, make sure ./NPLRuntime/win/bin is added to your search %path%; or you can simply use the full path to run your script (see below).
__YourSDKPath__/NPLRuntime/win/bin/npl helloworld.lua
ParacraftSDK's redist folder contains an installer of Paracraft.
Running Paracraft.exe from redist directory will install the latest version of Paracraft, which ships with NPLRuntime. ./NPLRuntime/install.bat copies only NPL runtime related files from redist folder to ./NPLRuntime/win/bin and ./NPLRuntime/win/packages
./NPLRuntime/win/packages contains pre-compiled source code of NPL libraries.
To deploy your application, you need to deploy both bin and packages folders together with your own script and resource files, such as
./bin/ :npl runtime 32bits
./bin64/ :npl runtime 64bits
./packages/ :npl precompiled source code
./script/ :your own script
./ :the working (root) directory of your application
In NPL script, you can reference any file using path relative to the working directory. So you need to make sure you start your app from the root directory.
ParacraftSDK contains many example projects written in NPL.
- See ParacraftSDK wiki site for more details.
- See Source Code Overview
Download Paracraft | ParacraftSDK | copyright by tatfook 2016 | upload image