Created
February 5, 2023 13:01
-
-
Save bsiegert/eb94f435e7f3782ea0d53797fc1d82a8 to your computer and use it in GitHub Desktop.
Go and Lua Hello World
This file contains 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
module github.com/bsiegert/luatest | |
go 1.19 | |
require github.com/Shopify/go-lua v0.0.0-20221004153744-91867de107cf // indirect |
This file contains 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
github.com/Shopify/go-lua v0.0.0-20221004153744-91867de107cf h1:VSUCKpFV0AfYGslgQSRdBI9HCVp1TCXJmScWD0VXL5g= | |
github.com/Shopify/go-lua v0.0.0-20221004153744-91867de107cf/go.mod h1:UCCi6u6YA8oXfJ15vEMiMGIaWWfLiOacinBPHxLXtEU= |
This file contains 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
package main | |
import lua "github.com/Shopify/go-lua" | |
func main() { | |
l := lua.NewState() | |
lua.OpenLibraries(l) | |
l.Global("print") | |
l.PushString("Hello World!\n") | |
l.Call(1, 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quick question, if I call
DoString
on the lua state, how can I retrieve the value of that lua code snippet? It seems the documentation is really lacking in go-lua.Thanks in advance!