Edoardo Lolletti
c20d9a4b38
Update copyright years in changed files
2025-05-30 23:09:29 +02:00
Edoardo Lolletti
50a2b9ba22
Add initial draft of lua managed group lifetime
2025-05-30 23:09:22 +02:00
Edoardo Lolletti
2e4ad52136
Update lua type retrieval and checking
...
Use the LUA_TXX macros alongside lua_type, to avoid implicit conversions (strings to integers and vice versa)
2024-03-02 19:58:42 +01:00
Edoardo Lolletti
dd32bac788
Made scriptlib::check_param templated
...
Made the function more constexpr friendly, removing the need to perform the switch at runtime.
Also now when a parameter doesn't match the required type, its type will also be printed in the error as well.
2024-03-01 17:57:41 +01:00
Edoardo Lolletti
9790b552a0
Address various warnings raised by clang's -Weverything
...
They were mostly extra breaks/extra semicolons
2024-01-05 15:50:25 +01:00
Edoardo Lolletti
ff41aec90a
Update header inclusion
2024-01-05 13:03:46 +01:00
Edoardo Lolletti
da45f91460
Update copyright for 2024
2024-01-03 01:21:08 +01:00
Edoardo Lolletti
6dc321de75
Make LuaParamType an enum class
2023-12-08 19:55:50 +01:00
Edoardo Lolletti
20fbf2d87e
LUA_FUNCTION: directly pass pduel in the function scope
...
Update lua functions to already have the pduel parameter passed inside them, thus not needing to manually retrieve them in the functions.
Add also a yieldk macro that does the same thing but for the yield continuation function, removing the redoundancies
2023-11-25 11:15:21 +01:00
Edoardo Lolletti
c9b3889ee8
Remove reintepret_cast
2022-11-02 13:01:42 +01:00
Edoardo Lolletti
6ee5546230
Scriptlib: use lua_isnone instead of checking the inxes against the stack top
...
The previous check would've failed with negative indices
2022-10-25 15:43:06 +02:00
Edoardo Lolletti
9bdd8b8a20
Make int parameter checking actually raise an error
...
Up until now it was only raising a warning and returning 0, enough time has passed and scripts should have all been updated to work properly.
2022-08-27 18:44:44 +02:00
Edoardo Lolletti
f255e1c883
Add helper lua_error function
...
Add this function marked as noreturn to avoid putting unreachable() after every luaL_error call
2022-06-23 11:47:00 +02:00
Edoardo Lolletti
eeb7b1922a
Remove redoundant check for PARAM_TYPE_DELETED
...
The object not being deleted is already being checked in ``lua_get<lua_obj*>``
2021-12-04 15:41:42 +01:00
Edoardo Lolletti
6d38d90aac
Move scriptlib::check_param_count to header
2021-12-04 15:41:13 +01:00
Edoardo Lolletti
686a8b3432
Make lua parameter types an enum and add value checking to lua_obj_helper
2021-10-13 18:20:52 +02:00
Edoardo Lolletti
984a81400a
Move is_deleted_object to a single source file
2021-10-13 18:18:02 +02:00
Edoardo Lolletti
c7d2accb8c
Remove scriptlib class
...
Make all the script functions scoped to their translation units, put the general functions under scriptlib namespace instead
2021-10-13 17:29:29 +02:00
Edoardo Lolletti
252d555f9e
Use bool in scriptlib::check_param
2021-10-13 16:54:13 +02:00
Edoardo Lolletti
f2ca3d82af
Some cleanups in scriptlib
2021-10-12 23:14:33 +02:00
Edoardo Lolletti
8fd5b97d04
Completely remove custom integer type typedefs
...
Directly use the standard's
2021-09-04 22:04:14 +02:00
Edoardo Lolletti
4a6e509356
Add unreachable macro
...
Uses _builtin_unreachable on gcc/clang and __assume(0) on msvc
2021-09-04 20:29:09 +02:00
Edoardo Lolletti
3a6da81d8c
Handle selections finished with 0 minimum cards
...
Now if a selection is "canceled", it'll be checked if the min was actually 0, in which case, an empty group will be returned instead of nil.
2021-04-19 12:04:28 +02:00
edo9300
22e710a335
Major cleanups in interpreter.cpp
...
Update lua functions calling functions, moved most of their common code in inline helper functions, simplify some code flow logic, use raw string literals when formatting strings
2021-01-07 19:42:30 +01:00
edo9300
6ec6a6cc06
Improved callback calls from duel class, replace sprintf interpreter function with "format", usign a buffer internal to the interpreter class
...
handle_message and read_script are now wrappers on top of the callbacks, will pass the payload and other needed parameters accordingly
2021-01-07 13:39:12 +01:00
edo9300
bb01859d6b
Add handling for onjects exposed to the lua api and still possibly referenced inside it
...
Currently the core just deallocated the internal object without doing nothing lua side, thus allowing the api to access invalid memory locations previously pointed by referenced objects. Added dummy `deleted` object that will take the place of any deleted lua/c object, raising errors when the api tries to read a lua_obj from the lua stack, so that the address pointed by the lua object will always be valid.
Also fixed possible crash when the label object passed to an EFFECT_TYPE_GRANT effect wasn't a valid effect.
2021-01-03 23:26:33 +01:00
edo9300
639a61fac7
Update lua functions related to strings
...
Remove global duel::strbuffer, this was a leftover from the old message handling, directly pass the string from lua to the callback function, and use local buffers when formatting is needed.
2020-11-06 22:40:01 +01:00
edo9300
d98ab684d7
Always use lua_get<duel*>() in library functions that have to access it
2020-10-30 17:05:28 +01:00
edo9300
83dbd1e6a7
Don't abort if passed parameter is not int, only log
2020-08-23 17:56:55 +02:00
edo9300
8268daf117
Treat boolean always valid, uinless it's a non valid index
...
To keep consistency with the language and the pre existing scripts
2020-07-23 23:49:06 +02:00
edo9300
368aa39b8c
Update check_param to also return the checked lua object, simplify optional parameters checking
2020-07-21 15:03:03 +02:00
edo9300
7f8eaedc59
Update lua getters in libduel
2020-07-21 00:08:06 +02:00
edo9300
dad1f3f462
Missing const qualifier
2020-07-20 20:58:34 +02:00
edo9300
ded6eeb7ac
Inherit group, card, effect form lua_object class, simplify userdata type handling
...
Have base class lua_obj also register the type of the parameter, so that we don't have to rely on calling lua functions, but the value of teh struct can be directly checked
2020-07-20 20:50:15 +02:00
edo9300
9e2a1ff5ba
Make various select functions cancelable
2020-03-14 18:40:09 +01:00
edo9300
a891c23ecb
Merge remote-tracking branch 'refs/remotes/Fluorohydride/master'
...
# Conflicts:
# effect.cpp
# field.cpp
# libduel.cpp
# libeffect.cpp
# operations.cpp
# premake4.lua
# processor.cpp
# scriptlib.h
2018-09-26 19:43:17 +02:00
DailyShana
49b33e46f3
make check_data_type only for internal usage
2018-09-11 18:39:26 +08:00
edo9300
a31bdd546a
Merge remote-tracking branch 'refs/remotes/Fluorohydride/master'
2018-08-13 19:02:22 +02:00
DailyShana
c6f757aa26
Revert "Revert "update scriptlib::check_param""
...
This reverts commit 5a392f8b2d .
2018-08-12 11:37:00 +08:00
purerosefallen
5a392f8b2d
Revert "update scriptlib::check_param"
...
This reverts commit 9a8ac816f7 .
2018-08-12 08:53:04 +08:00
DailyShana
9a8ac816f7
update scriptlib::check_param
2018-08-11 14:37:55 +08:00
fluorohydride
e8420f0738
submodule first push
2015-09-25 21:07:16 +08:00