Browse Source

moved 'test' script to example, updated package.json to remove test script

v0.1.x
Brett Langdon 13 years ago
parent
commit
9e58dc8bfc
5 changed files with 29 additions and 22 deletions
  1. +22
    -0
      example/example.js
  2. +6
    -0
      example/test.lua
  3. +1
    -1
      package.json
  4. +0
    -20
      test/test.js
  5. +0
    -1
      test/test.lua

+ 22
- 0
example/example.js View File

@ -0,0 +1,22 @@
var path = require('path');
var nodelua = require('../');
var lua = new nodelua.LuaObject();
lua.registerFunction('test_func', function(a,b){
console.dir(a+b);
});
lua.setGlobal("test", 5);
var test_file = path.resolve(__dirname, 'test.lua');
lua.doFile(test_file);
console.log("Global Var 'global_var' From Lua:");
console.dir(lua.getGlobal('global_var'));
var code = "print('Hello, Lua')";
lua.doString(code);
lua.close();

+ 6
- 0
example/test.lua View File

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

+ 1
- 1
package.json View File

@ -7,7 +7,7 @@
],
"main": "lib/index.js",
"scripts": {
"test": "test/test.js",
"test": "",
"install": "node-gyp rebuild"
},
"homepage": "http://github.com/brettlangdon/nodelua.git",


+ 0
- 20
test/test.js View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
var path = require('path');
var nodelua = require('../');
var lua = new nodelua.LuaObject();
var test_file = path.resolve(__dirname, 'test.lua');
lua.doFile(test_file);
lua.setGlobal("test", "value");
lua.setGlobal("one", 1);
lua.setGlobal("two", true);
lua.setGlobal("none", null);
console.dir(lua.getGlobal("one"));
console.dir(lua.getGlobal("test"));
console.dir(lua.getGlobal("none"));
console.dir(lua.getGlobal("two"));
lua.close();

+ 0
- 1
test/test.lua View File

@ -1 +0,0 @@
print "Hello, Lua"

Loading…
Cancel
Save