lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello

I have two questions.

>From manual: "Each thread has an independent global environment table. When
you create a thread, this table is the same as that of the given state, but
you can change each one independently."
This is mean, if I change a value in main thread, this is will independently
for a value for second thread?
I write example, but this is desn't work.

a=1; print("main thread: "..a);
co=coroutine.create(function()
  print("coroutine thread: "..a);
  a=2;
  print("coroutine thread: "..a);
  coroutine.yield();
  print("coroutine thread: "..a);
end);
a=3; print("main thread: "..a);
coroutine.resume(co)
print("main thread: "..a);
a=4; print("main thread: "..a);
coroutine.resume(co)

Second problem:
L1=lua_open(); L2=lua_open()
If I create string value "abc" in L1, then with "lua_xmove" copy to L2, this
value~="abc" in L2 context

Sincerely, Vyacheslav Kalitkin
www.magicworkstation.com