mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 21:11:50 +00:00
Merge branch 'dev' into client-server-logic-split
This commit is contained in:
commit
d0f3e0ee80
4 changed files with 9 additions and 6 deletions
|
|
@ -41,8 +41,8 @@ gfx.posteffects.set_array(
|
||||||
slot: int,
|
slot: int,
|
||||||
-- parameter (array) name
|
-- parameter (array) name
|
||||||
name: str
|
name: str
|
||||||
-- data string (use Bytearray_as_string function)
|
-- data
|
||||||
data: str
|
data: Bytearray
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Example of filling an array `#param vec3 u_arrayName[64]`:
|
-- Example of filling an array `#param vec3 u_arrayName[64]`:
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ gfx.posteffects.set_array(
|
||||||
slot: int,
|
slot: int,
|
||||||
-- имя параметра (массива)
|
-- имя параметра (массива)
|
||||||
name: string
|
name: string
|
||||||
-- строка данных (используйте функцию Bytearray_as_string)
|
-- данные
|
||||||
data: string
|
data: Bytearray
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Пример заполнения массива `#param vec3 u_имяМассива[64]`:
|
-- Пример заполнения массива `#param vec3 u_имяМассива[64]`:
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ static int l_set_params(lua::State* L) {
|
||||||
static int l_set_array(lua::State* L) {
|
static int l_set_array(lua::State* L) {
|
||||||
size_t index = static_cast<size_t>(lua::tointeger(L, 1));
|
size_t index = static_cast<size_t>(lua::tointeger(L, 1));
|
||||||
auto key = lua::require_string(L, 2);
|
auto key = lua::require_string(L, 2);
|
||||||
auto data = lua::require_lstring(L, 3);
|
auto data = lua::bytearray_as_string(L, 3);
|
||||||
auto effect = post_processing->getEffect(index);
|
auto effect = post_processing->getEffect(index);
|
||||||
if (effect == nullptr) {
|
if (effect == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -829,6 +829,9 @@ namespace lua {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string_view bytearray_as_string(lua::State* L, int idx) {
|
inline std::string_view bytearray_as_string(lua::State* L, int idx) {
|
||||||
|
if (type(L, idx) == LUA_TSTRING) {
|
||||||
|
return tolstring(L, idx);
|
||||||
|
}
|
||||||
pushvalue(L, idx);
|
pushvalue(L, idx);
|
||||||
requireglobal(L, "Bytearray_as_string");
|
requireglobal(L, "Bytearray_as_string");
|
||||||
pushvalue(L, -2);
|
pushvalue(L, -2);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue