aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_client.h
Commit message (Expand)AuthorAge
* [CSM] Add flavour limits controlled by server (#5930)Loïc Blot2017-07-18
* Revert "CSM: Revert "[CSM] Add send_chat_message and run_server_chatcommand""Loic Blot2017-07-15
* CSM: Revert "[CSM] Add send_chat_message and run_server_chatcommand"rubenwardy2017-07-15
* Create a filesystem abstraction layer for CSM and only allow accessing files ...red-0012017-06-30
* [CSM] Add function to get player privileges (#5933)red-0012017-06-07
* [CSM] Add send_chat_message and run_server_chatcommand API functions (#5747)Pierre-Adrien Langrognet2017-05-21
* Fix LINT broken by dfa0c15ce045705f05487d623dc7beca6c945b4bLoic Blot2017-05-21
* [CSM] Add function to get the definition of items (#5732)bigfoot5472017-05-21
* [CSM] Correct the log destination of print() (#5784)SmallJoker2017-05-20
* Add function to get server info.red-0012017-05-04
* [CSM] add screenshot api lua (#5674)Vincent Glize2017-04-29
* [CSM] Add function to get the server protocol version. (#5529)red-0012017-04-06
* [CSM] Add support for positional audio. (#5516)red-0012017-04-06
* [CSM] Add local node meta reference. (#5508)red-0012017-04-04
* [CSM] Add function and chat command to disconnect from server. (#5487)red-0012017-04-01
* Fix clang-format Columns WidthLoic Blot2017-03-31
* [CSM] Add function to get player names in range (#5435)bigfoot5472017-03-22
* Add `get_wielded_item`red-0012017-03-13
* [CSM] Add `get_node` and `get_node_or_nil`red-0012017-03-13
* [CSM] storage + fixesLoic Blot2017-03-13
* [CSM] Add local formspecs. (#5094)red-0012017-03-13
* [CSM] sound_play & sound_stop support + client_lua_api doc (#5096)Loïc Blot2017-03-13
* [CSM] Add client-sided chat commands (#5092)red-0012017-03-13
* [CSM] Add method that display chat to client-sided lua. (#5089) (#5091)red-0012017-03-13
* [CSM] Client side moddingLoic Blot2017-03-13
/* chain it */ newhash[h1] = p; p = next; } } luaM_freearray(L, tb->hash, tb->size, TString *); tb->size = newsize; tb->hash = newhash; } static TString *newlstr (lua_State *L, const char *str, size_t l, unsigned int h) { TString *ts; stringtable *tb; if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) luaM_toobig(L); ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); ts->tsv.len = l; ts->tsv.hash = h; ts->tsv.marked = luaC_white(G(L)); ts->tsv.tt = LUA_TSTRING; ts->tsv.reserved = 0; memcpy(ts+1, str, l*sizeof(char)); ((char *)(ts+1))[l] = '\0'; /* ending 0 */ tb = &G(L)->strt; h = lmod(h, tb->size); ts->tsv.next = tb->hash[h]; /* chain new entry */ tb->hash[h] = obj2gco(ts); tb->nuse++; if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) luaS_resize(L, tb->size*2); /* too crowded */ return ts; } TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { GCObject *o; unsigned int h = cast(unsigned int, l); /* seed */ size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ size_t l1; for (l1=l; l1>=step; l1-=step) /* compute hash */ h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; o != NULL; o = o->gch.next) { TString *ts = rawgco2ts(o); if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { /* string may be dead */ if (isdead(G(L), o)) changewhite(o); return ts; } } return newlstr(L, str, l, h); /* not found */ } Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { Udata *u; if (s > MAX_SIZET - sizeof(Udata)) luaM_toobig(L); u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); u->uv.marked = luaC_white(G(L)); /* is not finalized */ u->uv.tt = LUA_TUSERDATA; u->uv.len = s; u->uv.metatable = NULL; u->uv.env = e; /* chain it on udata list (after main thread) */ u->uv.next = G(L)->mainthread->next; G(L)->mainthread->next = obj2gco(u); return u; }