llgo/c/lua:table & coroutine

This commit is contained in:
luoliwoshang
2024-06-30 19:35:45 +08:00
parent 7a294e6d4e
commit a5d7fc484a
10 changed files with 419 additions and 125 deletions

View File

@@ -6,9 +6,8 @@ import (
)
// printStack prints the current stack of the given Lua state.
func printStack(L *lua.Lua_State, stateName *c.Char) {
func printStack(L *lua.State, stateName *c.Char) {
top := L.GetTop()
// c.Printf(c.Str("%s stack (top=%d): "), c.GoStringData("sdasd"), top)
c.Printf(c.Str("%s stack (top=%d):"), stateName, top)
for i := 1; i <= int(top); i++ {
c.Printf(c.Str("%s "), L.ToString(c.Int(i)))
@@ -73,7 +72,7 @@ func main() {
defer L1.Close()
// Move two elements to the new state
L.Xmove(L1, c.Int(2))
L.XMove(L1, c.Int(2))
c.Printf(c.Str("\nAfter moving two elements to L1:\n"))
printStack(L, c.Str("L1"))
printStack(L1, c.Str("L2"))