From 275eb91b30e2f002fd3bd5c73e4759e5b3f87a6f Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Mon, 19 Aug 2013 07:39:41 -0400 Subject: [PATCH] update function example to catch exception --- examples/functions/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/functions/index.js b/examples/functions/index.js index fae5e8f..31d3eed 100644 --- a/examples/functions/index.js +++ b/examples/functions/index.js @@ -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)"); \ No newline at end of file +try{ + lua_two.doStringSync("add(10, 5)"); +} catch(e){ + console.log("Error: "); + console.log(e); +}