Freeciv-3.3: /fast/freeciv/nightly/main/client/luascript/tolua_client_gen.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
tolua_client_gen.c
Go to the documentation of this file.
1/*
2** Lua binding: client
3*/
4
5#include "tolua.h"
6
7#ifndef __cplusplus
8#include <stdlib.h>
9#endif
10#ifdef __cplusplus
11 extern "C" int tolua_bnd_takeownership (lua_State* L); // from tolua_map.c
12#else
13 int tolua_bnd_takeownership (lua_State* L); /* from tolua_map.c */
14#endif
15#include <string.h>
16
17/* Exported function */
18 TOLUA_API int tolua_client_open (lua_State* tolua_S);
19 LUALIB_API int luaopen_client (lua_State* tolua_S);
20
21#ifdef HAVE_CONFIG_H
22#include <fc_config.h>
23#endif
24#include "luascript_types.h"
25#include "api_client_base.h"
26#include "script_client.h"
27
28/* function to register type */
29 static void tolua_reg_types (lua_State* tolua_S)
30{
31}
32
33/* function: api_client_chat_base */
34 static int tolua_client_chat_base00(lua_State* tolua_S)
35{
36#ifndef TOLUA_RELEASE
37 tolua_Error tolua_err;
38 if (
39 !tolua_isstring(tolua_S,1,0,&tolua_err) ||
40 !tolua_isnoobj(tolua_S,2,&tolua_err)
41 )
42 goto tolua_lerror;
43 else
44#endif
45 {
46 lua_State* L = tolua_S;
47 const char* message = ((const char*) tolua_tostring(tolua_S,1,0));
48 {
49 api_client_chat_base(L,message);
50 }
51 }
52 return 0;
53#ifndef TOLUA_RELEASE
54 tolua_lerror:
55 tolua_error(tolua_S,"#ferror in function 'base'.",&tolua_err);
56 return 0;
57#endif
58}
59
60/* Open lib function */
61 LUALIB_API int luaopen_client (lua_State* tolua_S)
62{
63 tolua_open(tolua_S);
64 tolua_reg_types(tolua_S);
65 tolua_module(tolua_S,NULL,0);
66 tolua_beginmodule(tolua_S,NULL);
67 tolua_module(tolua_S,"chat",0);
68 tolua_beginmodule(tolua_S,"chat");
69 tolua_function(tolua_S,"base",tolua_client_chat_base00);
70 tolua_endmodule(tolua_S);
71
72 { /* begin embedded lua code */
73 static unsigned char B[] = {
74 10,102,117,110, 99,116,105,111,110, 32, 99,104, 97,116, 46,
75 109,115,103, 40,102,109,116, 44, 32, 46, 46, 46, 41, 10, 99,
76 104, 97,116, 46, 98, 97,115,101, 40,115,116,114,105,110,103,
77 46,102,111,114,109, 97,116, 40,102,109,116, 44, 32, 46, 46,
78 46, 41, 41, 10,101,110,100,32
79 };
80 if (luaL_loadbuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code") == LUA_OK)
81 lua_pcall(tolua_S,0,LUA_MULTRET,0);
82 } /* end of embedded lua code */
83
84 tolua_endmodule(tolua_S);
85 return 1;
86}
87/* Open tolua function */
88 TOLUA_API int tolua_client_open (lua_State* tolua_S)
89{
90 lua_pushcfunction(tolua_S, luaopen_client);
91 lua_pushstring(tolua_S, "client");
92 lua_call(tolua_S, 1, 0);
93 return 1;
94}
api_client_chat_base
void api_client_chat_base(lua_State *L, const char *msg)
Definition api_client_base.c:32
api_client_base.h
incite_cost
char * incite_cost
Definition comments.c:74
luascript_types.h
script_client.h
message
Definition messagewin_common.h:29
tolua_client_open
TOLUA_API int tolua_client_open(lua_State *tolua_S)
Definition tolua_client_gen.c:88
tolua_reg_types
static void tolua_reg_types(lua_State *tolua_S)
Definition tolua_client_gen.c:29
tolua_bnd_takeownership
int tolua_bnd_takeownership(lua_State *L)
tolua_client_chat_base00
static int tolua_client_chat_base00(lua_State *tolua_S)
Definition tolua_client_gen.c:34
luaopen_client
LUALIB_API int luaopen_client(lua_State *tolua_S)
Definition tolua_client_gen.c:61