/[enigma]/enigma/lib-src/libtolua/tolua_rg.c
ViewVC logotype

Diff of /enigma/lib-src/libtolua/tolua_rg.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dheck, Sun Jan 5 20:04:45 2003 UTC revision 1.2 by reallysoft, Mon May 19 12:12:43 2003 UTC
# Line 6  Line 6 
6  ** $Id$  ** $Id$
7  */  */
8    
9  /* This code is free software; you can redistribute it and/or modify it.  /* This code is free software; you can redistribute it and/or modify it.
10  ** The software provided hereunder is on an "as is" basis, and  ** The software provided hereunder is on an "as is" basis, and
11  ** the author has no obligation to provide maintenance, support, updates,  ** the author has no obligation to provide maintenance, support, updates,
12  ** enhancements, or modifications.  ** enhancements, or modifications.
13  */  */
14    
15  #include <stdio.h>  #include <stdio.h>
# Line 50  void tolua_globalarray (lua_State* L,cha Line 50  void tolua_globalarray (lua_State* L,cha
50   lua_newtable(L);   lua_newtable(L);
51   lua_settag(L,tag);   lua_settag(L,tag);
52   lua_setglobal(L,name);   lua_setglobal(L,name);
53    
54   lua_pushcfunction(L,get);   lua_pushcfunction(L,get);
55   lua_settagmethod(L,tag,"gettable");   lua_settagmethod(L,tag,"gettable");
56   if (set)   if (set)
57    lua_pushcfunction(L,set);    lua_pushcfunction(L,set);
58   else   else
# Line 60  void tolua_globalarray (lua_State* L,cha Line 60  void tolua_globalarray (lua_State* L,cha
60   lua_settagmethod(L,tag,"settable");   lua_settagmethod(L,tag,"settable");
61  }  }
62    
63  void tolua_tablevar  void tolua_tablevar
64  (lua_State* L, char* table, char* name, lua_CFunction get, lua_CFunction set)  (lua_State* L, const char* table, const char* name, lua_CFunction get, lua_CFunction set)
65  {  {
66   lua_getglobal(L,table);   lua_getglobal(L,table);
67    
# Line 102  static int toluaI_get_array (lua_State* Line 102  static int toluaI_get_array (lua_State*
102   lua_gettable(L,-2);   lua_gettable(L,-2);
103   lua_getglobal(L,lua_tostring(L,-1));   lua_getglobal(L,lua_tostring(L,-1));
104   lua_pushstring(L,".array");   lua_pushstring(L,".array");
105   lua_gettable(L,-2);               lua_gettable(L,-2);
106   lua_pushvalue(L,2);    /* field */   lua_pushvalue(L,2);    /* field */
107   lua_gettable(L,-2);   lua_gettable(L,-2);
108   lua_pushstring(L,".self");   lua_pushstring(L,".self");
# Line 141  void tolua_tablearray Line 141  void tolua_tablearray
141   tolua_tablevar(L,table,name,toluaI_get_array,NULL);   tolua_tablevar(L,table,name,toluaI_get_array,NULL);
142  }  }
143    
144  void tolua_module (lua_State* L, char* name)  void tolua_module (lua_State* L, const char* name)
145  {  {
146   lua_getglobal(L,name);   lua_getglobal(L,name);
147   if (!lua_istable(L,-1))   if (!lua_istable(L,-1))
# Line 161  void tolua_module (lua_State* L, char* n Line 161  void tolua_module (lua_State* L, char* n
161   lua_pop(L,1);   lua_pop(L,1);
162  }  }
163    
164  void tolua_cclass (lua_State* L, char* name, char* base)  void tolua_cclass (lua_State* L, const char* name, const char* base)
165  {  {
166   int t;   int t;
167   lua_newtable(L);   lua_newtable(L);
# Line 182  void tolua_cclass (lua_State* L, char* n Line 182  void tolua_cclass (lua_State* L, char* n
182   }   }
183   lua_pushvalue(L,-1);  /* duplicate top */   lua_pushvalue(L,-1);  /* duplicate top */
184   lua_setglobal(L,name);   lua_setglobal(L,name);
185   t = lua_gettop(L);   t = lua_gettop(L);
186   toluaI_tm_class(L,t,name);   toluaI_tm_class(L,t,name);
187   toluaI_tt_class(L,t,name,base);   toluaI_tt_class(L,t,name,base);
188   lua_pop(L,1);   lua_pop(L,1);
# Line 206  void tolua_function (lua_State* L, char* Line 206  void tolua_function (lua_State* L, char*
206   }   }
207  }  }
208    
209  void tolua_constant (lua_State* L, char* parent, char* name, double value)  void tolua_constant (lua_State* L, const char* parent, const char* name, double value)
210  {  {
211   if (parent==NULL)   if (parent==NULL)
212   {   {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26