Created
July 1, 2017 16:03
-
-
Save X-Raym/58a1eb5acb7092dbfcb82a2fabf34dcb to your computer and use it in GitHub Desktop.
Lua to JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- | |
| // | |
| local | |
| var | |
| = {} | |
| = [] | |
| == | |
| === | |
| if(.+)then | |
| if($1){ | |
| else | |
| } else { | |
| end | |
| } | |
| for (.+), (.+) in pairs\((.+)\) do | |
| $3.forEach(function($2){ | |
| for (.+), (.+) in ipairs\((.+)\) do | |
| $3.forEach(function($2){ | |
| // NEED TO ADD A ); AFTER THE BLOCK ! | |
| for (.+) do | |
| for ( $1 ) { | |
| function self\.(.+)\((.+|.?)\) | |
| this.$1 = function($2) { | |
| (.+) = (.+) | |
| // Add var in front. need to be done carefully. | |
| #([A-Z-.]+) | |
| $1.length | |
| table.insert\((.+), (.+)\) | |
| $1.push($2) | |
| and | |
| && | |
| .. | |
| + | |
| nil | |
| undefined | |
| Get first chraacter | |
| :sub(1,1) | |
| .charAt(0) | |
| Delete first chraacter | |
| :sub(2) | |
| .substring(1) | |
| Loop in each lines | |
| for ( l in string.gmatch(text, '[^\r\n]+') ) { | |
| var lines = str.split("\n"); | |
| lines.forEach(function(line) { | |
| :find | |
| .search( | |
| :gsub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment