mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Replace Optional with std::optional
This commit is contained in:
parent
34ad551efc
commit
e700182f44
15 changed files with 39 additions and 198 deletions
|
@ -59,7 +59,7 @@ bool ScriptApiItem::item_OnDrop(ItemStack &item,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ScriptApiItem::item_OnPlace(Optional<ItemStack> &ret_item,
|
||||
bool ScriptApiItem::item_OnPlace(std::optional<ItemStack> &ret_item,
|
||||
ServerActiveObject *placer, const PointedThing &pointed)
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
@ -88,13 +88,13 @@ bool ScriptApiItem::item_OnPlace(Optional<ItemStack> &ret_item,
|
|||
throw WRAP_LUAERROR(e, "item=" + item.name);
|
||||
}
|
||||
} else {
|
||||
ret_item = nullopt;
|
||||
ret_item = std::nullopt;
|
||||
}
|
||||
lua_pop(L, 2); // Pop item and error handler
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScriptApiItem::item_OnUse(Optional<ItemStack> &ret_item,
|
||||
bool ScriptApiItem::item_OnUse(std::optional<ItemStack> &ret_item,
|
||||
ServerActiveObject *user, const PointedThing &pointed)
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
@ -118,13 +118,13 @@ bool ScriptApiItem::item_OnUse(Optional<ItemStack> &ret_item,
|
|||
throw WRAP_LUAERROR(e, "item=" + item.name);
|
||||
}
|
||||
} else {
|
||||
ret_item = nullopt;
|
||||
ret_item = std::nullopt;
|
||||
}
|
||||
lua_pop(L, 2); // Pop item and error handler
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScriptApiItem::item_OnSecondaryUse(Optional<ItemStack> &ret_item,
|
||||
bool ScriptApiItem::item_OnSecondaryUse(std::optional<ItemStack> &ret_item,
|
||||
ServerActiveObject *user, const PointedThing &pointed)
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
@ -146,7 +146,7 @@ bool ScriptApiItem::item_OnSecondaryUse(Optional<ItemStack> &ret_item,
|
|||
throw WRAP_LUAERROR(e, "item=" + item.name);
|
||||
}
|
||||
} else {
|
||||
ret_item = nullopt;
|
||||
ret_item = std::nullopt;
|
||||
}
|
||||
lua_pop(L, 2); // Pop item and error handler
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue