| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- // package main
- // import "git.wecise.com/wecise/odbserver/lua"
- // import "fmt"
- // func test(L *lua.State) int {
- // fmt.Println("hello world! come from go!")
- // return 0
- // }
- // func test2(L *lua.State) int {
- // arg := L.CheckInteger(-1)
- // argfrombottom := L.CheckInteger(1)
- // fmt.Print("test2 arg: ")
- // fmt.Println(arg)
- // fmt.Print("from bottom: ")
- // fmt.Println(argfrombottom)
- // return 0
- // }
- // func main() {
- // L := lua.NewState()
- // defer L.Close()
- // L.OpenLibs()
- // L.GetField(lua.LUA_GLOBALSINDEX, "print")
- // L.PushString("Hello World!")
- // L.Call(1, 0)
- // L.PushGoFunction(test)
- // L.PushGoFunction(test)
- // L.PushGoFunction(test)
- // L.PushGoFunction(test)
- // L.PushGoFunction(test2)
- // L.PushInteger(42)
- // L.Call(1, 0)
- // L.Call(0, 0)
- // L.Call(0, 0)
- // L.Call(0, 0)
- // // this will fail as we didn't register test2 function
- // err := L.DoString("test2(42)")
- // fmt.Printf("Ciao %v\n", err)
- // }
|