aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-01-15 11:11:22 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-01-15 11:11:22 -0200
commit54840fb25696ab30e11d2d80f3c18af6d1f01481 (patch)
treeb2d0fd6ad4dd450ba7f845e6c1ea3d73efcbd7f6
parente87fddf1adab8ca60ec988c9d71d29a44d7129a3 (diff)
downloadlua-54840fb25696ab30e11d2d80f3c18af6d1f01481.tar.gz
lua-54840fb25696ab30e11d2d80f3c18af6d1f01481.tar.bz2
lua-54840fb25696ab30e11d2d80f3c18af6d1f01481.zip
new functions to manipulate C global variables
-rw-r--r--lapi.c47
-rw-r--r--lstate.c8
-rw-r--r--luadebug.h7
3 files changed, 51 insertions, 11 deletions
diff --git a/lapi.c b/lapi.c
index d5c16369..5f75649f 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.29 1998/12/03 15:45:15 roberto Exp roberto $ 2** $Id: lapi.c,v 1.30 1998/12/30 17:26:49 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -425,8 +425,42 @@ void lua_settag (int tag)
425} 425}
426 426
427 427
428
428/* 429/*
430** {======================================================
431** To manipulate the implementation global variables
429** ======================================================= 432** =======================================================
433*/
434
435lua_State *lua_setstate (lua_State *st) {
436 lua_State *old = lua_state;
437 lua_state = st;
438 return old;
439}
440
441lua_LHFunction lua_setlinehook (lua_LHFunction func) {
442 lua_LHFunction old = lua_linehook;
443 lua_linehook = func;
444 return old;
445}
446
447lua_CHFunction lua_setcallhook (lua_CHFunction func) {
448 lua_CHFunction old = lua_callhook;
449 lua_callhook = func;
450 return old;
451}
452
453int lua_setdebug (int debug) {
454 int old = lua_debug;
455 lua_debug = debug;
456 return old;
457}
458
459/* }====================================================== */
460
461
462/*
463** {======================================================
430** Debug interface 464** Debug interface
431** ======================================================= 465** =======================================================
432*/ 466*/
@@ -541,8 +575,11 @@ char *lua_getobjname (lua_Object o, char **name)
541 else return ""; 575 else return "";
542} 576}
543 577
578/* }====================================================== */
579
580
544/* 581/*
545** ======================================================= 582** {======================================================
546** BLOCK mechanism 583** BLOCK mechanism
547** ======================================================= 584** =======================================================
548*/ 585*/
@@ -582,9 +619,11 @@ lua_Object lua_getref (int ref)
582 return (o ? put_luaObject(o) : LUA_NOOBJECT); 619 return (o ? put_luaObject(o) : LUA_NOOBJECT);
583} 620}
584 621
622/* }====================================================== */
623
585 624
586/* 625/*
587** ======================================================= 626** {======================================================
588** Derived functions 627** Derived functions
589** ======================================================= 628** =======================================================
590*/ 629*/
@@ -602,6 +641,8 @@ void (lua_pushcfunction) (lua_CFunction f) { lua_pushcfunction(f); }
602 641
603int (lua_clonetag) (int t) { return lua_clonetag(t); } 642int (lua_clonetag) (int t) { return lua_clonetag(t); }
604 643
644/* }====================================================== */
645
605 646
606 647
607 648
diff --git a/lstate.c b/lstate.c
index 434bd0bd..8547c176 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $ 2** $Id: lstate.c,v 1.6 1998/06/02 20:37:04 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -78,9 +78,3 @@ void lua_close (void)
78} 78}
79 79
80 80
81lua_State *lua_setstate (lua_State *st) {
82 lua_State *old = lua_state;
83 lua_state = st;
84 return old;
85}
86
diff --git a/luadebug.h b/luadebug.h
index 12e951cd..dbc5a1d0 100644
--- a/luadebug.h
+++ b/luadebug.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luadebug.h,v 1.2 1998/06/19 16:14:09 roberto Exp roberto $ 2** $Id: luadebug.h,v 1.3 1998/09/07 18:59:59 roberto Exp roberto $
3** Debugging API 3** Debugging API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -31,4 +31,9 @@ extern lua_CHFunction lua_callhook;
31extern int lua_debug; 31extern int lua_debug;
32 32
33 33
34extern lua_LHFunction lua_setlinehook (lua_LHFunction func);
35extern lua_CHFunction lua_setcallhook (lua_CHFunction func);
36extern int lua_setdebug (int debug);
37
38
34#endif 39#endif