4 static Mapa
* mapa
= NULL
;
6 static int regmap (lua_State
*L
) {
7 double width
= lua_tonumber(L
, 1);
8 double height
= lua_tonumber(L
, 2);
10 spawn
.x
= lua_tonumber(L
, 3);
11 spawn
.y
= lua_tonumber(L
, 4);
12 mapa
->setSpawn(spawn
);
13 mapa
->setTamanho(width
,height
);
17 static int regplatform (lua_State
*L
) {
18 mapa
->novaPlataforma(luaL_checknumber(L
, 1),
19 luaL_checknumber(L
, 2),
20 luaL_checknumber(L
, 3),
21 luaL_checknumber(L
, 4),
26 static int regweapon (lua_State
*L
) {
27 const char* nome
= lua_tostring(L
, 1);
28 double x
= lua_tonumber(L
, 2);
29 double y
= lua_tonumber(L
, 3);
30 mapa
->dropWeapon(nome
, Ponto(x
, y
));
34 void MapLoader::load(std::string name
, Mapa
* m
) {
36 lua_State
* l
= newState();
37 registerFunction(l
,"regmap",regmap
);
38 registerFunction(l
,"regplatform",regplatform
);
39 registerFunction(l
,"regweapon",regweapon
);
40 doLuaFile(l
,"maploader.lua");
41 doLuaFile(l
,name
.c_str());