mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
add player name
This commit is contained in:
parent
97a4741a73
commit
acc4d2540d
6 changed files with 50 additions and 1 deletions
|
|
@ -236,6 +236,20 @@ static int l_set_camera(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_get_name(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
return lua::pushstring(L, player->getName());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_name(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
player->setName(lua::require_string(L, 2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg playerlib[] = {
|
||||
{"get_pos", lua::wrap<l_get_pos>},
|
||||
{"set_pos", lua::wrap<l_set_pos>},
|
||||
|
|
@ -261,5 +275,7 @@ const luaL_Reg playerlib[] = {
|
|||
{"set_entity", lua::wrap<l_set_entity>},
|
||||
{"get_camera", lua::wrap<l_get_camera>},
|
||||
{"set_camera", lua::wrap<l_set_camera>},
|
||||
{"get_name", lua::wrap<l_get_name>},
|
||||
{"set_name", lua::wrap<l_set_name>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue