route/vendor/github.com/kohkimakimoto/gluaquestion
Cadey Ratio 18a2049013 cmd/construct: start work on eclier frontend 2018-01-21 20:28:06 -08:00
..
.gitignore cmd/construct: start work on eclier frontend 2018-01-21 20:28:06 -08:00
LICENSE cmd/construct: start work on eclier frontend 2018-01-21 20:28:06 -08:00
README.md cmd/construct: start work on eclier frontend 2018-01-21 20:28:06 -08:00
question.go cmd/construct: start work on eclier frontend 2018-01-21 20:28:06 -08:00

README.md

gluaquestion

A library of gopher-lua to prompt the user for input.

Installation

go get github.com/kohkimakimoto/gluaquestion

API

  • question.ask(text)
  • question.secret(text)

Usage

package main

import (
    "github.com/yuin/gopher-lua"
    "github.com/kohkimakimoto/gluaquestion"
)

func main() {
    L := lua.NewState()
    defer L.Close()

    L.PreloadModule("question", gluaquestion.Loader)
    if err := L.DoString(`
local question = require("question")

local name = question.ask("What's your name: ")
print("hello " .. name)

-- What's your name: kohki
-- hello kohki

`); err != nil {
        panic(err)
    }
}