[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Method Tables - a modified Lua 4.1 Work Beta implementation
- From: "Joshua Jensen" <jjensen@...>
- Date: Wed, 28 Nov 2001 15:55:19 -0700
After the discussion about unified methods, I have copied just the
method table code from the LuaState distribution and put it in a clean
Lua 4.1 Work Beta implementation.
Credit for the method tables implementation goes to Edgar Toernig, who
created the method tables for Sol. Except for the parser changes and
new VM opcodes, this is 100% Edgar's work.
Documentation can be found in the "Unified Methods" and "Standard
Unified Method Callbacks" sections of
http://www.workspacewhiz.com/Other/LuaState/LuaState.html with the
* The LuaState :: operator is now a .> operator, so it more closely
mirrors the regular . table indexing operator.
* The LuaState -> operator is now a :> operator, so it more closely
mirrors the regular : function calling operator.
* Due to parser changes in Lua 4.1 Work Beta (as opposed to Lua 4.1
Alpha), it is no longer possible to:
The modified directories can be found here. Just do a diff of the
original Lua 4.1 Work Beta code and this code to see the small number of
* Added luaL_openlibintotable() helper function (Sol).
* Added LUA_NTYPES #define. (Sol)
* Added lua_getmethods(). (Sol)
* Added lua_getdefaultmethods(). (Sol)
* Added lua_setmethods(). (Sol)
* Implements lua_getmethods(). (Sol)
* Implements lua_getdefaultmethods(). (Sol)
* Implements lua_setmethods(). (Sol)
* Added a case for the new VINDEXEDMETHOD type in luaK_dischargevars().
* Added function luaK_selfmethod().
* Added function luaK_indexedmethod().
* Added functions travtable() and travmethods(). (Sol)
* In function getname(), a travmethods() call has been added. (Sol)
* Function marktable() has been upgraded to check the methods table.
* markobject() has been upgraded to wander user data's methods. (Sol)
* checkMbuffer() has been fixed to compile under VC6.
* Added function luaB_methods(). (Sol)
* Default method tables are created. (Sol)
* File method table created. (Sol)
* Number method table created. (Sol)
* String method table created. (Sol)
* In luaX_lex(), the cases for a . (period) and : (colon) have been
to check for > (greater than) symbols following.
* The struct Udata has a Table* methods member added. (Sol)
* The struct Table has a Table* methods member added. (Sol)
* Upgraded to handle the new opcodes OP_GETMETHOD and OP_SELFMETHOD.
* Function luaY_methodsfield() added.
* In primaryexp(), cases for TK_COLONGT and TK_PERIODGT have been added.
* VINDEXEDMETHOD enum added to expkind.
* In function f_luaopen(), method tables are built into the global
* struct global_State has Table* methods[LUA_NTYPES] array added. (Sol)
* luaS_newudata() assigns the default userdata method table. (Sol)
* luaH_new() assigns the default table method table. (Sol)
* In function newkey(), settableval() was fixed to compile under VC6.
* Functions luaT_getmethods() and luaT_setmethods() added. (Sol)
* Function luaV_getmethod() added.
* Virtual machine opcodes OP_GETMETHOD and OP_SELFMETHOD implemented.