server/src/bind_order.c

51 lines
1.0 KiB
C
Raw Normal View History

#ifdef _MSC_VER
#include <platform.h>
#endif
2015-12-30 21:22:28 +01:00
/* kernel includes */
#include <kernel/order.h>
#include <util/parser.h>
#include <util/macros.h>
2015-12-30 21:22:28 +01:00
/* lua includes */
2018-09-23 19:44:05 +02:00
#include <lua.h>
2015-12-30 21:22:28 +01:00
#include <tolua.h>
#include <stdlib.h>
static int tolua_order_get_token(lua_State *L) {
order *ord = (order *)tolua_tousertype(L, 1, 0);
int n = (int)tolua_tonumber(L, 2, 0);
const char * str = 0;
2017-10-09 20:33:47 +02:00
init_order_depr(ord);
2015-12-30 21:22:28 +01:00
while (n-->0) {
str = getstrtoken();
if (!str) {
return 0;
}
}
tolua_pushstring(L, str);
return 1;
}
void tolua_order_open(lua_State * L)
{
/* register user types */
tolua_usertype(L, TOLUA_CAST "order");
tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL);
{
tolua_cclass(L, TOLUA_CAST "order", TOLUA_CAST "order", TOLUA_CAST "",
NULL);
tolua_beginmodule(L, TOLUA_CAST "order");
{
tolua_function(L, TOLUA_CAST "token", tolua_order_get_token);
}
tolua_endmodule(L);
}
tolua_endmodule(L);
}