loslib.cpp File Reference

#include <errno.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"

Go to the source code of this file.

Defines

#define loslib_c
#define LUA_LIB

Functions

static int os_pushresult (lua_State *L, int i, const char *filename)
static int os_execute (lua_State *L)
static int os_remove (lua_State *L)
static int os_rename (lua_State *L)
static int os_tmpname (lua_State *L)
static int os_getenv (lua_State *L)
static int os_clock (lua_State *L)
static void setfield (lua_State *L, const char *key, int value)
static void setboolfield (lua_State *L, const char *key, int value)
static int getboolfield (lua_State *L, const char *key)
static int getfield (lua_State *L, const char *key, int d)
static int os_date (lua_State *L)
static int os_time (lua_State *L)
static int os_difftime (lua_State *L)
static int os_setlocale (lua_State *L)
static int os_exit (lua_State *L)
LUALIB_API int luaopen_os (lua_State *L)

Variables

static const luaL_Reg syslib []


Define Documentation

#define loslib_c

Definition at line 14 of file loslib.cpp.

#define LUA_LIB

Definition at line 15 of file loslib.cpp.


Function Documentation

static int getboolfield ( lua_State L,
const char *  key 
) [static]

Definition at line 100 of file loslib.cpp.

References lua_getfield(), lua_isnil, lua_pop, and lua_toboolean().

Referenced by os_time().

static int getfield ( lua_State L,
const char *  key,
int  d 
) [static]

Definition at line 109 of file loslib.cpp.

References int(), lua_getfield(), lua_isnumber(), lua_pop, LUA_QS, lua_tointeger(), and luaL_error().

Referenced by os_time().

LUALIB_API int luaopen_os ( lua_State L  ) 

Definition at line 240 of file loslib.cpp.

static int os_clock ( lua_State L  )  [static]

Definition at line 74 of file loslib.cpp.

References lua_pushnumber().

static int os_date ( lua_State L  )  [static]

Definition at line 124 of file loslib.cpp.

References lua_createtable(), lua_pushnil(), luaL_addchar, luaL_addlstring(), luaL_buffinit(), luaL_checknumber(), luaL_opt, luaL_optstring, luaL_pushresult(), NULL, setboolfield(), setfield(), and LangStringUtil::strcmp().

static int os_difftime ( lua_State L  )  [static]

Definition at line 195 of file loslib.cpp.

References lua_pushnumber(), luaL_checknumber(), and luaL_optnumber().

static int os_execute ( lua_State L  )  [static]

Definition at line 38 of file loslib.cpp.

References lua_pushinteger(), luaL_optstring, and NULL.

static int os_exit ( lua_State L  )  [static]

Definition at line 216 of file loslib.cpp.

References luaL_optint.

static int os_getenv ( lua_State L  )  [static]

Definition at line 68 of file loslib.cpp.

References lua_pushstring(), and luaL_checkstring.

static int os_pushresult ( lua_State L,
int  i,
const char *  filename 
) [static]

Definition at line 23 of file loslib.cpp.

References lua_pushboolean(), lua_pushfstring(), lua_pushinteger(), and lua_pushnil().

Referenced by os_remove(), and os_rename().

static int os_remove ( lua_State L  )  [static]

Definition at line 44 of file loslib.cpp.

References luaL_checkstring, and os_pushresult().

static int os_rename ( lua_State L  )  [static]

Definition at line 50 of file loslib.cpp.

References luaL_checkstring, and os_pushresult().

static int os_setlocale ( lua_State L  )  [static]

Definition at line 204 of file loslib.cpp.

References lua_pushstring(), luaL_checkoption(), luaL_optstring, and NULL.

static int os_time ( lua_State L  )  [static]

Definition at line 170 of file loslib.cpp.

References getboolfield(), getfield(), lua_isnoneornil, lua_pushnil(), lua_pushnumber(), lua_settop(), LUA_TTABLE, luaL_checktype(), and NULL.

static int os_tmpname ( lua_State L  )  [static]

Definition at line 57 of file loslib.cpp.

References lua_pushstring(), and luaL_error().

static void setboolfield ( lua_State L,
const char *  key,
int  value 
) [static]

Definition at line 93 of file loslib.cpp.

References lua_pushboolean(), and lua_setfield().

Referenced by os_date().

static void setfield ( lua_State L,
const char *  key,
int  value 
) [static]

Definition at line 88 of file loslib.cpp.

References lua_pushinteger(), and lua_setfield().

Referenced by os_date().


Variable Documentation

const luaL_Reg syslib[] [static]

Initial value:

 {
  {"clock",     os_clock},
  {"date",      os_date},
  {"difftime",  os_difftime},
  {"execute",   os_execute},
  {"exit",      os_exit},
  {"getenv",    os_getenv},
  {"remove",    os_remove},
  {"rename",    os_rename},
  {"setlocale", os_setlocale},
  {"time",      os_time},
  {"tmpname",   os_tmpname},
  {NULL, NULL}
}

Definition at line 221 of file loslib.cpp.


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3