mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
add console.get(...) & add 'player' console variable
This commit is contained in:
parent
2e89cc14ee
commit
9c630645b4
4 changed files with 9 additions and 2 deletions
|
|
@ -43,6 +43,11 @@ static int l_execute(lua::State* L) {
|
|||
}
|
||||
}
|
||||
|
||||
static int l_get(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
return lua::pushvalue(L, (*engine->getCommandsInterpreter())[name]);
|
||||
}
|
||||
|
||||
static int l_set(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
auto value = lua::tovalue(L, 2);
|
||||
|
|
@ -119,6 +124,7 @@ static int l_get_command_info(lua::State* L) {
|
|||
const luaL_Reg consolelib[] = {
|
||||
{"add_command", lua::wrap<l_add_command>},
|
||||
{"execute", lua::wrap<l_execute>},
|
||||
{"get", lua::wrap<l_get>},
|
||||
{"set", lua::wrap<l_set>},
|
||||
{"get_commands_list", lua::wrap<l_get_commands_list>},
|
||||
{"get_command_info", lua::wrap<l_get_command_info>},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue