lstring.h 757 B

123456789101112131415161718192021222324252627
  1. /*
  2. ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $
  3. ** String table (keep all strings handled by Lua)
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef lstring_h
  7. #define lstring_h
  8. #include "lgc.h"
  9. #include "lobject.h"
  10. #include "lstate.h"
  11. #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char))
  12. #define sizeudata(u) (sizeof(union Udata)+(u)->len)
  13. #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
  14. #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
  15. (sizeof(s)/sizeof(char))-1))
  16. LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
  17. LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
  18. LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  19. #endif