Browse Source

added INFO constants, updated example, README and version bump

v0.1.x
Brett Langdon 13 years ago
parent
commit
3a29f3a52b
5 changed files with 26 additions and 4 deletions
  1. +11
    -2
      README.md
  2. +3
    -0
      example/example.js
  3. +1
    -1
      example/test.lua
  4. +1
    -1
      package.json
  5. +10
    -0
      src/nodelua.cc

+ 11
- 2
README.md View File

@ -23,7 +23,7 @@ The `NodeLua` module itself only contains a single object `LuaObject` used to in
var lua = new nodelua.LuaObject() var lua = new nodelua.LuaObject()
``` ```
### STATUS
#### STATUS
`STATUS` is an object that contains the constants for values returned by `LuaObject.status()`. `STATUS` is an object that contains the constants for values returned by `LuaObject.status()`.
`nodelua.STATUS` conatins the following constants: `nodelua.STATUS` conatins the following constants:
@ -33,7 +33,7 @@ var lua = new nodelua.LuaObject()
* `ERRMEM: 4` * `ERRMEM: 4`
* `ERRERR: 5` * `ERRERR: 5`
## GC
#### GC
`GC` is an object of constants used for controlling the lua garbage collector. `GC` is an object of constants used for controlling the lua garbage collector.
`nodelua.GC` conatins the following constants: `nodelua.GC` conatins the following constants:
@ -46,6 +46,15 @@ var lua = new nodelua.LuaObject()
* `SETPAUSE: 6` * `SETPAUSE: 6`
* `SETSTEPMUL: 7` * `SETSTEPMUL: 7`
#### INFO
`INFO` is an object containing constants with information about the version of lua you are using.
`nodelua.INFO` contains the following constants:
* `VERSION`
* `VERSION_NUM`
* `COPYRIGHT`
* `AUTHORS`
### LuaObject ### LuaObject
The `LuaObject` is an object wrapper around a `lua_State` instance. The `LuaObject` is an object wrapper around a `lua_State` instance.


+ 3
- 0
example/example.js View File

@ -1,6 +1,9 @@
var path = require('path'); var path = require('path');
var nodelua = require('../'); var nodelua = require('../');
console.log('Lua Info:');
console.dir(nodelua.INFO);
var lua = new nodelua.LuaObject(); var lua = new nodelua.LuaObject();
lua.registerFunction('test_func', function(a,b){ lua.registerFunction('test_func', function(a,b){


+ 1
- 1
example/test.lua View File

@ -1,5 +1,5 @@
print("Calling JS Function 'test_func' From Lua"); print("Calling JS Function 'test_func' From Lua");
print(nodelua("test_func", 3, 5))
nodelua("test_func", 3, 5)
global_var = 'this is a global variable from lua' global_var = 'this is a global variable from lua'

+ 1
- 1
package.json View File

@ -1,6 +1,6 @@
{ {
"name": "nodelua", "name": "nodelua",
"version": "0.1.2",
"version": "0.1.3",
"description": "Lua Bindings For Node.JS", "description": "Lua Bindings For Node.JS",
"keywords": [ "keywords": [
"lua" "lua"


+ 10
- 0
src/nodelua.cc View File

@ -9,6 +9,15 @@ extern "C"{
using namespace v8; using namespace v8;
void init_info_constants(Handle<Object> target){
Local<Object> constants = Object::New();
constants->Set(String::NewSymbol("VERSION"), String::New(LUA_VERSION));
constants->Set(String::NewSymbol("VERSION_NUM"), Number::New(LUA_VERSION_NUM));
constants->Set(String::NewSymbol("COPYRIGHT"), String::New(LUA_COPYRIGHT));
constants->Set(String::NewSymbol("AUTHORS"), String::New(LUA_AUTHORS));
target->Set(String::NewSymbol("INFO"), constants);
}
void init_status_constants(Handle<Object> target){ void init_status_constants(Handle<Object> target){
Local<Object> constants = Object::New(); Local<Object> constants = Object::New();
constants->Set(String::NewSymbol("YIELD"), Number::New(LUA_YIELD)); constants->Set(String::NewSymbol("YIELD"), Number::New(LUA_YIELD));
@ -36,5 +45,6 @@ void init(Handle<Object> target) {
LuaObject::Init(target); LuaObject::Init(target);
init_gc_constants(target); init_gc_constants(target);
init_status_constants(target); init_status_constants(target);
init_info_constants(target);
} }
NODE_MODULE(nodelua, init) NODE_MODULE(nodelua, init)

Loading…
Cancel
Save