All Projects → fiatjaf → Glua

fiatjaf / Glua

Maybe you should use https://github.com/fiatjaf/flua instead of this

Programming Languages

go
31211 projects - #10 most used programming language
lua
6591 projects

Labels

Projects that are alternatives of or similar to Glua

gox
JSX for Go
Stars: ✭ 165 (+16.2%)
Mutual labels:  gopherjs
vecty-chatapp
Vecty Samples
Stars: ✭ 13 (-90.85%)
Mutual labels:  gopherjs
Vdom
A virtual dom implementation written in go which is compatible with gopherjs
Stars: ✭ 83 (-41.55%)
Mutual labels:  gopherjs
iris
The interpreter of ISLisp
Stars: ✭ 58 (-59.15%)
Mutual labels:  gopherjs
gopherjs-frappe-charts
[experimental/outdated; frappe v0.07] GopherJS bindings for frappe/charts - simple Go charts for your frontend
Stars: ✭ 20 (-85.92%)
Mutual labels:  gopherjs
Vecty Router
A declarative client-side router for Vecty applications.
Stars: ✭ 24 (-83.1%)
Mutual labels:  gopherjs
Lute
🎼 一款对中文语境优化的 Markdown 引擎,支持 Go 和 JavaScript。A structured Markdown engine that supports Go and JavaScript.
Stars: ✭ 222 (+56.34%)
Mutual labels:  gopherjs
Gu
A web ui library for Go. [DEPRECATED]
Stars: ✭ 102 (-28.17%)
Mutual labels:  gopherjs
golang-101
🍺 In-depth internals, my personal notes, example codes and projects. Includes - Thousands of codes, OOP, Concurrency, Parallelism, Goroutines, Mutexes & Wait Groups, Testing in Go, Go tool chain, Backend web development, Some projects including Log file parser using bufio.Scanner, Spam Masker, Retro led clock, Console animations, Dictionary pro…
Stars: ✭ 61 (-57.04%)
Mutual labels:  gopherjs
Userpages
my blog for sharing (source code for siongui.github.io)
Stars: ✭ 64 (-54.93%)
Mutual labels:  gopherjs
react
Super lightweight Go bindings for react.js
Stars: ✭ 130 (-8.45%)
Mutual labels:  gopherjs
go-pouchdb
GopherJS bindings for PouchDB ⚠️ NOTICE ⚠️ this package has been superseded by https://github.com/go-kivik/kivik
Stars: ✭ 12 (-91.55%)
Mutual labels:  gopherjs
Gopherjs Electron
Gopherjs bindings for Electron with an API translator.
Stars: ✭ 26 (-81.69%)
Mutual labels:  gopherjs
qlql
No description or website provided.
Stars: ✭ 26 (-81.69%)
Mutual labels:  gopherjs
Grpcweb Example
An example implementation of a GopherJS client and a Go server using the Improbable gRPC-Web implementation
Stars: ✭ 85 (-40.14%)
Mutual labels:  gopherjs
React
MOVED TO https://github.com/myitcv/x/blob/master/react/_doc/README.md
Stars: ✭ 234 (+64.79%)
Mutual labels:  gopherjs
Goplayspace
Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more
Stars: ✭ 765 (+438.73%)
Mutual labels:  gopherjs
Godom
Make DOM manipulation in Go as similar to JavaScript as possible. (via GopherJS or WebAssembly)
Stars: ✭ 125 (-11.97%)
Mutual labels:  gopherjs
Humble
The main repository for Humble. Issues and new feature requests not related to any specific sub-packages go here.
Stars: ✭ 92 (-35.21%)
Mutual labels:  gopherjs
Instago
Download/access photos, videos, stories, story highlights, postlives, following and followers of Instagram
Stars: ✭ 59 (-58.45%)
Mutual labels:  gopherjs

glua npm badge

glua is what happens when you compile https://github.com/J-J-J/goluajit, a Lua VM written in Go (based on https://github.com/yuin/gopher-lua), to Javascript. It works right now and you can use it for most awesomeness. You don't have to know Go or even click on the link above, just use this library in your favorite JS environment.

example:

const glua = require('glua')

glua.run(`
  print(12, 'lala', true)
`) // will print these values

var result

glua.runWithGlobals({
  diff: function (a, b) {
    return Math.abs(Math.abs(b) - Math.abs(a))
  },
  saveResult: function (value) {
    result = value
  }
}, `
  local a = 23
  local b = 74
  local difference = diff(a, b)
  saveResult(difference)
`)

console.log('the result is: ', result)

glua.runWithModules({
  fooprinter: `
local fooprinter = {}

function fooprinter.print (foo)
  print('foo value is: ', foo)
end

return fooprinter
  `
}, {
  foo: 264857
}, `
local fooprinter = require('fooprinter')
print('printing foo...')
fooprinter.print(foo)
`)

try it now

Visit https://raw.githack.com/fiatjaf/glua/master/try.html and use your console.

how do I

  1. Return multiple values from a JavaScript function?

Return the special object {_glua_multi: []} with an array of the multiple values you want your function to return.

  1. Get values out from the Lua environment?

Call .runWithGlobals passing a function that takes the parameters from Lua and saves them to a JavaScript variable. It works.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].