Toribash
Original Post
Toribash Lua Library System
I have found myself needing to reuse the same code snippets over and over, so instead of re-including them in all the different scripts, I decided to write a easy-to-use library system.

Library files are pre-compiled binary files that can be loaded at the top of a program, and can include functions and constants and things of that sort to help you get things done faster. I am hoping that also the scripters of toribash can come together and build a fairly comprehensive "third-party" sdk for useful things like lua-driven window management, interface objects,
3d math tools, toribash-specific math, and other things of that sort.

This zip file contains the basic tools needed to load and export libraries, and also a few libraries to get you started.

To install:

Extract the contents of the zip file AS IS into your scripts folder. Read lib_help.txt for more info.

The 2 libraries included are:
inputbox.lib - A basic input box that passes the input to a specified function.
debug.lib - A helper library to set watches on variables and display them anywhere on the screen. Also, you can press F12 to input script commands and have them executed right away (useful for echoing variables or to change the value of a variable on the fly.)

To write new libraries, read the library_info.txt file in the lib folder. There is also a template provided for library txt files named template.txt.

For any other help, post here and I will answer as soon as I can get back to an internet connection.

-UPDATE-
Oops, forgot to include the library dumper <.< Thanks Dafe
Attached Files
library.zip (7.0 KB, 59 views)
lib_dump.lua (285 Bytes, 33 views)
Last edited by NewbLuck; Dec 19, 2007 at 02:56 AM.
 ____  _____  __  __  _  _  ___  _  _ 
(  _ \(  _  )(  )(  )( \( )/ __)( \/ )
 ) _ < )(_)(  )(__)(  )  (( (__  \  / 
(____/(_____)(______)(_)\_)\___) (__) 
(Sorry for the epic bump) But its a really usefull system!
:D
Here's a library for doing some needed calculations. Here's a copypasta from the readme.

Special operations/keys:
------------------------

Provides functions for distance between 2 points, distance between 2 joints,
angle between 2 points around an axis, angle between 2 joints around an axis,
determining if a number is in a specified range around another, and if a
2d point is within a set of boundaries.

Attached Files
lib.rar (2.0 KB, 15 views)
 ____  _____  __  __  _  _  ___  _  _ 
(  _ \(  _  )(  )(  )( \( )/ __)( \/ )
 ) _ < )(_)(  )(__)(  )  (( (__  \  / 
(____/(_____)(______)(_)\_)\___) (__) 
Lua script error in file CustomHUD13B.lua: ./data/script/Forms.lua:5: attempt to call global 'include' (a nil value)

Thats CustomHud13B.lua is running Forms.lua which has ' include "calc.lib" ' which is at line 5.
Last edited by Blam; Feb 9, 2008 at 10:50 PM.
:D
Inheritance probably, try moving the dofile and include to the other one (hud to form, or from to hud)
 ____  _____  __  __  _  _  ___  _  _ 
(  _ \(  _  )(  )(  )( \( )/ __)( \/ )
 ) _ < )(_)(  )(__)(  )  (( (__  \  / 
(____/(_____)(______)(_)\_)\___) (__) 
Ok, tried
dofile("CustomHUD13B.lua")
include "calc.lib"
in forms and it didnt work, so I tried
include "calc.lib"
dofile("Forms.lua")
in the hud one. Didn't work either, same error.
:D
What about the dofile("libloader.lua")
 ____  _____  __  __  _  _  ___  _  _ 
(  _ \(  _  )(  )(  )( \( )/ __)( \/ )
 ) _ < )(_)(  )(__)(  )  (( (__  \  / 
(____/(_____)(______)(_)\_)\___) (__) 
...
*facepalms self*
thanks.
:D