mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
binary json format introduced + specification
This commit is contained in:
parent
faa581a928
commit
3837cdcf95
13 changed files with 649 additions and 326 deletions
|
|
@ -14,6 +14,13 @@
|
|||
#include "../../lighting/Lighting.h"
|
||||
#include "../../logic/BlocksController.h"
|
||||
|
||||
inline int lua_pushivec3(lua_State* L, int x, int y, int z) {
|
||||
lua_pushinteger(L, x);
|
||||
lua_pushinteger(L, y);
|
||||
lua_pushinteger(L, z);
|
||||
return 3;
|
||||
}
|
||||
|
||||
inline void luaL_openlib(lua_State* L, const char* name, const luaL_Reg* libfuncs, int nup) {
|
||||
lua_newtable(L);
|
||||
luaL_setfuncs(L, libfuncs, nup);
|
||||
|
|
@ -44,11 +51,6 @@ static const luaL_Reg worldlib [] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
int luaopen_world(lua_State* L) {
|
||||
luaL_openlib(L, "world", worldlib, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* == player library ==*/
|
||||
static int l_player_get_pos(lua_State* L) {
|
||||
int playerid = lua_tointeger(L, 1);
|
||||
|
|
@ -102,11 +104,6 @@ static const luaL_Reg playerlib [] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
int luaopen_player(lua_State* L) {
|
||||
luaL_openlib(L, "player", playerlib, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* == blocks-related functions == */
|
||||
static int l_block_name(lua_State* L) {
|
||||
int id = lua_tointeger(L, 1);
|
||||
|
|
@ -158,13 +155,6 @@ static int l_get_block(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int lua_pushivec3(lua_State* L, int x, int y, int z) {
|
||||
lua_pushinteger(L, x);
|
||||
lua_pushinteger(L, y);
|
||||
lua_pushinteger(L, z);
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int l_get_block_x(lua_State* L) {
|
||||
int x = lua_tointeger(L, 1);
|
||||
int y = lua_tointeger(L, 2);
|
||||
|
|
@ -275,8 +265,8 @@ static int l_is_replaceable_at(lua_State* L) {
|
|||
lua_setglobal(L, NAME))
|
||||
|
||||
void apilua::create_funcs(lua_State* L) {
|
||||
luaopen_world(L);
|
||||
luaopen_player(L);
|
||||
luaL_openlib(L, "world", worldlib, 0);
|
||||
luaL_openlib(L, "player", playerlib, 0);
|
||||
|
||||
lua_addfunc(L, l_block_index, "block_index");
|
||||
lua_addfunc(L, l_block_name, "block_name");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue