summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/ltm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/ltm.c')
-rw-r--r--apps/plugins/lua/ltm.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/apps/plugins/lua/ltm.c b/apps/plugins/lua/ltm.c
index 69b4ed7727..c27f0f6fab 100644
--- a/apps/plugins/lua/ltm.c
+++ b/apps/plugins/lua/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 2.14.1.1 2013/04/12 18:48:47 roberto Exp $ 2** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -19,22 +19,20 @@
19#include "ltm.h" 19#include "ltm.h"
20 20
21 21
22static const char udatatypename[] = "userdata";
23 22
24LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { 23const char *const luaT_typenames[] = {
25 "no value", 24 "nil", "boolean", "userdata", "number",
26 "nil", "boolean", udatatypename, "number", 25 "string", "table", "function", "userdata", "thread",
27 "string", "table", "function", udatatypename, "thread", 26 "proto", "upval"
28 "proto", "upval" /* these last two cases are used for tests only */
29}; 27};
30 28
31 29
32void luaT_init (lua_State *L) { 30void luaT_init (lua_State *L) {
33 static const char *const luaT_eventname[] = { /* ORDER TM */ 31 static const char *const luaT_eventname[] = { /* ORDER TM */
34 "__index", "__newindex", 32 "__index", "__newindex",
35 "__gc", "__mode", "__len", "__eq", 33 "__gc", "__mode", "__eq",
36 "__add", "__sub", "__mul", "__div", "__mod", 34 "__add", "__sub", "__mul", "__div", "__mod",
37 "__pow", "__unm", "__lt", "__le", 35 "__pow", "__unm", "__len", "__lt", "__le",
38 "__concat", "__call" 36 "__concat", "__call"
39 }; 37 };
40 int i; 38 int i;
@@ -62,7 +60,7 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
62 60
63const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { 61const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
64 Table *mt; 62 Table *mt;
65 switch (ttypenv(o)) { 63 switch (ttype(o)) {
66 case LUA_TTABLE: 64 case LUA_TTABLE:
67 mt = hvalue(o)->metatable; 65 mt = hvalue(o)->metatable;
68 break; 66 break;
@@ -70,7 +68,7 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
70 mt = uvalue(o)->metatable; 68 mt = uvalue(o)->metatable;
71 break; 69 break;
72 default: 70 default:
73 mt = G(L)->mt[ttypenv(o)]; 71 mt = G(L)->mt[ttype(o)];
74 } 72 }
75 return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); 73 return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
76} 74}