diff --git a/index.js b/index.js index 3f03041..898ef09 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,10 @@ function transpileType(type) { return transpileType(type.slice(0, -2)) + '[]'; } + if (type.startsWith('LuaMultiReturn<[') && type.endsWith(']>')) { + return type.replace('LuaMultiReturn<[','').replace(']>','').split(',').map(t => transpileType(t.split(':')[1])).join(', '); + } + if (type.includes('|')) { return type.split('|').map(t => transpileType(t)).join(' | '); } @@ -139,7 +143,7 @@ function parse(code) { // look for functions let functionFreeCode = code; - const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]\s|<>,]+))?/g; // wow this sucks + const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]\s|<>,:]+))?/g; // wow this sucks while ((match = functions.exec(code)) !== null) { parsedElements++; functionFreeCode = functionFreeCode.replace(match[0], '');