7 class lua_print
: public lua_function
10 lua_print() : lua_function("print") {}
11 int invoke(lua_State
* LS
)
14 while(!lua_isnone(LS
, stacksize
+ 1))
18 for(int i
= 0; i
< stacksize
; i
++) {
20 const char* tmp
= NULL
;
21 if(lua_isnil(LS
, i
+ 1)) {
24 } else if(lua_isboolean(LS
, i
+ 1) && lua_toboolean(LS
, i
+ 1)) {
27 } else if(lua_isboolean(LS
, i
+ 1) && !lua_toboolean(LS
, i
+ 1)) {
31 tmp
= lua_tolstring(LS
, i
+ 1, &len
);
33 tmp
= "(unprintable)";
37 std::string
localmsg(tmp
, tmp
+ len
);
41 toprint
= toprint
+ "\t" + localmsg
;
44 window::message(toprint
);
49 class lua_exec
: public lua_function
52 lua_exec() : lua_function("exec") {}
53 int invoke(lua_State
* LS
)
55 std::string text
= get_string_argument(LS
, 1, fname
.c_str());
56 command::invokeC(text
);