Skip to content

Instantly share code, notes, and snippets.

@X-Raym
Created July 1, 2017 16:03
Show Gist options
  • Select an option

  • Save X-Raym/58a1eb5acb7092dbfcb82a2fabf34dcb to your computer and use it in GitHub Desktop.

Select an option

Save X-Raym/58a1eb5acb7092dbfcb82a2fabf34dcb to your computer and use it in GitHub Desktop.
Lua to JavaScript
--
//
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