/[enigma]/enigma/src/lua.cc
ViewVC logotype

Diff of /enigma/src/lua.cc

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

revision 1.10 by reallysoft, Tue May 20 20:51:09 2003 UTC revision 1.11 by dheck, Thu Jun 12 10:51:26 2003 UTC
# Line 44  using world::GridPos; Line 44  using world::GridPos;
44    
45  namespace lua  namespace lua
46  {  {
     class LuaState {  
     public:  
         LuaState (size_t stacksize = 0);  
         ~LuaState();  
   
         lua_State *get_state() const { return m_state; }  
     private:  
         LuaState (const LuaState &);  
         LuaState &operator = (const LuaState &);  
   
         /*  
         ** Variables  
         */  
         lua_State *m_state;  
     };  
   
     typedef int LuaTag;  
   
   
     class NumberType {  
   
     };  
   
     class UserType {  
     public:  
         UserType (LuaState *state);  
   
         LuaTag get_tag() const { return m_tag; }  
   
         bool is_type (int idx) {  
             lua_State *L = m_state->get_state();  
             return lua_isuserdata(L, idx) && lua_tag(L,idx)==m_tag;  
         }  
   
     private:  
         LuaState *m_state;  
         LuaTag m_tag;  
     };  
 }  
   
 LuaState::LuaState (size_t stacksize)  
 {  
     m_state = lua_open(stacksize);  
 }  
   
 LuaState::~LuaState()  
 {  
     lua_close(state);  
 }  
   
 namespace lua  
 {  
47      lua_State *state = 0;       // global Lua state      lua_State *state = 0;       // global Lua state
48      int object_tag;             // Lua tag for `Object's      int object_tag;             // Lua tag for `Object's
49  }  }
# Line 423  lua::CallFunc(const char *funcname, cons Line 371  lua::CallFunc(const char *funcname, cons
371      return lua_call(state, 1, 0);      return lua_call(state, 1, 0);
372  }  }
373    
374  int  int lua::Dofile(const string &filename)
 lua::Dofile(const string &filename)  
375  {  {
376      string fname = enigma::FindDataFile(filename);      string fname = enigma::FindDataFile(filename);
377    
# Line 434  lua::Dofile(const string &filename) Line 381  lua::Dofile(const string &filename)
381      return retval;      return retval;
382  }  }
383    
384    int lua::Dobuffer (const vector<char> &luacode)
385    {
386        return lua_dobuffer (state, &luacode[0], luacode.size(), "buffer");
387    }
388    
389    
390  int  int
391  lua::DoSubfolderfile(const string &basefolder, const string &filename)  lua::DoSubfolderfile(const string &basefolder, const string &filename)
392  {  {

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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