Browse Source

update function example to catch exception

v0.3.x
Brett Langdon 12 years ago
parent
commit
275eb91b30
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      examples/functions/index.js

+ 6
- 2
examples/functions/index.js View File

@ -9,5 +9,9 @@ lua.registerFunction('add', function(a, b){
lua.doStringSync("print('Result in Lua: ' .. add(10, 5))");
var lua_two = new nodelua.LuaState('two');
// this will throw an error
lua_two.doStringSync("add(10, 5)");
try{
lua_two.doStringSync("add(10, 5)");
} catch(e){
console.log("Error: ");
console.log(e);
}

Loading…
Cancel
Save