Menu

The_Pipmak_Library_Project

Christian Walther Andrea Viarengo James C.  Wilson

Introduction

This is a preliminary document describing Lua library inclusion.

Lua libraries are a collection of lua functions to semplify writing of complex lua code and the reuse of the code.

Lua permit some Object Oriented style (OOP) with some limitation, so it would be better if these functions are organized in Objects (one object for library), attribute and methods.

The method proposed is very simple and must be improved to:

  • manage library version
  • avoid that one library was included more that one time (if a library require another library...)

Suggestions and contributing are welcome!

Some libraries in the list at the end of this page, are in an initial development stage, others are just an ideas, and everyone can contribute defining the library interface (i.e.: I like to have a library that do this...with this methods...) or writing the lua code, propose adding methods to existing object and so on.

With the progression of Pipmak development, Could be possible which some libraries were included in Pipmak as native (maybe with different syntax), in that case, library must remain as stub converting old syntax to new and maintaining backward compatibility for old projects which use those libraries.

For the moment, a library file cannot include other library itself,but all library inclusions must be only in main.lua.

Example: if menu.lua require color.lua, You have to include both in main.lua (as described in next paragraph) even if you don't use color.lua alone.

How to use

Folder structure

All library files are located in the folder lib under the main folder (which contain main.lua).

If a library require a specific resource (like an image, a sound, ..), these can be put in the folder lib/res.

So, the folder structure is

 MyProject.pipmak
 MyProject.pipmak/main.lua
 MyProject.pipmak/1/node.lua
 MyProject.pipmak/2/node.lua
 MyProject.pipmak/3/node.lua
 MyProject.pipmak/lib
 MyProject.pipmak/lib/color.lua
 MyProject.pipmak/lib/menu.lua
 MyProject.pipmak/lib/res
 MyProject.pipmak/lib/res/image1.png
 MyProject.pipmak/lib/res/image2.png

Library inclusion

To include a library in your project, you must add these line to main.lua:

 pipmak.dofile("lib/color.lua")
 pipmak.dofile("lib/dialog.lua")

One line for each library that you want to include.

Library list

  • [Library_color.lua] A better color management in Pipmak (Available)
  • [Library_dialog.lua] Dialog box management (will require build 155 or more - working in progress)
  • [Library_menu.lua] Menu management (will require build 155 or more - working in progress)
  • Library inventory.lua Inventory management (just an idea...)
  • Library animation.lua Simple animation (waiting video features...just an idea...)
  • [Library_object3D.lua] Simple 3D object using arbitrary patch positioning (will require build 155 or more - working in progress)
  • [Library_autocubic.lua] Automatic scenes creation from description map - (working in progress)
  • Library flashlight.lua A simple flashlight effect (A work in progress. Will be posted soon)
  • Library sunglare.lua A sun glare effect (A work in progress. Will be posted soon)
  • Library lightrefract.lua Realtime image based light refraction effect (A work in progress. Will be posted soon)
  • Library curvemotion.lua _A library to assist smooth, curve-based motion, such as a fly flying about. _ (A work in progress. Will be posted at some point in the near, middle future)
  • Library smoothrotate.lua A library to assist smooth panoramic rotation (A work in progress. Will be posted fairly soon)

Related

Wiki: Library_autocubic.lua
Wiki: Library_color.lua
Wiki: Library_dialog.lua
Wiki: Library_menu.lua
Wiki: Library_object3D.lua
Wiki: Main_Page