Lua 五個 Alpha 到 Beta

lua-users home
wiki

VersionNotice:此頁面關係到 Lua 的開發版本(5.0 alpha 和 beta)。

不相容性

我們即將要釋出 Lua 5.0 beta。以下是從 5.0 alpha 到 5.0 beta 的不 tương容性列表。(大多數都與 coroutines 有關;這是 Lua 仍然很新的領域。)

LUA_API lua_State *lua_newthread (lua_State *L);

會將新的執行緒保留在堆疊上。除了主執行緒之外的所有執行緒都是可以被垃圾回收的。對 coroutine 來說,這正是我們需要的。其他的多執行緒系統(例如 LuaThreads??)可能會儲存在登錄檔中,例如避免它們的集合中。

x = coroutine.create(function (a,b,c) print(a,b,c) print(coroutine.yield()) print(coroutine.yield()) end)

coroutine.resume(x, 1, 2, 3) --> 1, 2, 3 coroutine.resume(x, 10) --> 10 coroutine.resume(x, 4, 5) --> 4, 5 print(coroutine.resume(x)) --> false 無法重新開始已停止的 coroutine

-- Roberto


新功能

以下是 5.0 beta(相較於 5.0 alpha)中的一些新功能。它們應該不會在 "一般" 程式中造成不 tương容性。


RecentChanges · 喜好設定
編輯 · 記錄
最後編輯時間:2009 年 3 月 16 日 上午 10:23 GMT (差異)