Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

options-script.h File Reference

Go to the source code of this file.

Functions

int script_options_sendMsg (lua_State *L) throw ()
 void sendMsg(listener, msg, [value])
int script_options_setParam (lua_State *L) throw ()
 void setParam(name, value)
int script_options_getParam (lua_State *L) throw ()
 string getParam(name) Returns string or nil.


Function Documentation

int script_options_getParam lua_State *  L  )  throw ()
 

string getParam(name) Returns string or nil.

Definition at line 70 of file options-script.cpp.

00071 {
00072     BEGIN_NOEXCEPTION;
00073     const char *name = luaL_checkstring(L, 1);
00074     std::string value = OptionAgent::agent()->getParam(name);
00075     if (value.empty()) {
00076         lua_pushnil(L);
00077     }
00078     else {
00079         lua_pushlstring(L, value.c_str(), value.size());
00080     }
00081     END_NOEXCEPTION;
00082     //NOTE: return value
00083     return 1;
00084 }

int script_options_sendMsg lua_State *  L  )  throw ()
 

void sendMsg(listener, msg, [value])

Definition at line 24 of file options-script.cpp.

00025 {
00026     BEGIN_NOEXCEPTION;
00027     BaseMsg *message = NULL;
00028     const char *listener = luaL_checkstring(L, 1);
00029     const char *msg = luaL_checkstring(L, 2);
00030     if (lua_isstring(L, 3)) {
00031         const char *string_value = luaL_checkstring(L, 3);
00032         message = new StringMsg(listener, msg, string_value);
00033     }
00034     else if (lua_isnumber(L, 3)) {
00035         int int_value = luaL_checkint(L, 3);
00036         message = new IntMsg(listener, msg, int_value);
00037     }
00038     else {
00039         message = new SimpleMsg(listener, msg);
00040     }
00041 
00042     MessagerAgent::agent()->forwardNewMsg(message);
00043 
00044     END_NOEXCEPTION;
00045     return 0;
00046 }

int script_options_setParam lua_State *  L  )  throw ()
 

void setParam(name, value)

Definition at line 52 of file options-script.cpp.

00053 {
00054     BEGIN_NOEXCEPTION;
00055     const char *name = luaL_checkstring(L, 1);
00056     const char *value = lua_tostring(L, 2);
00057     if (!value) {
00058         value = luaL_checkstring(L, 2);
00059     }
00060     OptionAgent::agent()->setParam(name, value);
00061     END_NOEXCEPTION;
00062     return 0;
00063 }


Generated on Wed Jun 1 09:54:32 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2