Software /
code /
prosody
Comparison
util-src/table.c @ 6610:7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 11:59:17 +0100 |
child | 6615:8e4572a642cb |
comparison
equal
deleted
inserted
replaced
6608:b6e558febb7a | 6610:7c4cf87f4dff |
---|---|
1 #include <lua.h> | |
2 #include <lauxlib.h> | |
3 | |
4 static int Lcreate_table(lua_State* L) { | |
5 lua_createtable(L, luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)); | |
6 return 1; | |
7 } | |
8 | |
9 int luaopen_util_table(lua_State *L) { | |
10 lua_newtable(L); | |
11 lua_pushcfunction(L, Lcreate_table); | |
12 lua_setfield(L, -2, "create"); | |
13 return 1; | |
14 } |