Skip to content

Commit 545d931

Browse files
committed
Fix bugs with multiret
1 parent 52697dc commit 545d931

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openspace-api-js",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "OpenSpace Socket/Websocket API bindings for JavaScript",
55
"main": "src/node.js",
66
"browser": {

src/api.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ class OpenSpaceApi {
294294
return async (...args) => {
295295
try {
296296
const luaTable = await this.executeLuaFunction(functionName, args);
297-
return luaTable[1];
297+
if (luaTable) {
298+
return luaTable[1];
299+
}
300+
return null;
298301
} catch (e) {
299302
throw "Lua execution error: \n" + e
300303
}
@@ -338,7 +341,7 @@ class OpenSpaceApi {
338341
* This method only returns the first return value.
339342
*/
340343
async singleReturnLibrary() {
341-
return await this.library(true);
344+
return await this.library(false);
342345
}
343346

344347
/**
@@ -348,7 +351,7 @@ class OpenSpaceApi {
348351
* with 1-indexed values.
349352
*/
350353
async multiReturnLibrary() {
351-
return await this.library(false);
354+
return await this.library(true);
352355
}
353356
}
354357

0 commit comments

Comments
 (0)