Skip to content

Commit

Permalink
Support bit32.* all by github.com/BixData/gluabit32 for #319
Browse files Browse the repository at this point in the history
  • Loading branch information
hymkor committed Jul 3, 2018
1 parent 6b4421f commit 831e0a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
14 changes: 0 additions & 14 deletions mains/bit32lua.go

This file was deleted.

11 changes: 10 additions & 1 deletion mains/lua.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"runtime"
"time"

"github.com/BixData/gluabit32"
"github.com/yuin/gopher-lua"

"github.com/zetamatta/nyagos/completion"
Expand Down Expand Up @@ -159,7 +160,15 @@ func NewLua() (Lua, error) {
L.SetGlobal("share", shareTable)

setupUtf8Table(L)
setupBit32Table(L)
gluabit32.Preload(L)
L.Push(L.GetGlobal("require"))
L.Push(lua.LString("bit32"))
if err := L.PCall(1, 1, nil); err == nil {
L.SetGlobal("bit32", L.Get(-1))
L.Pop(1)
} else {
fmt.Fprintf(os.Stderr, "bit32: %s\n", err.Error())
}

L.SetGlobal("print", L.NewFunction(lua2param(functions.CmdPrint)))

Expand Down

0 comments on commit 831e0a6

Please sign in to comment.