Commit graph

47 commits

Author SHA1 Message Date
LJ Sonic
c2a8d1f7ea Merge branch 'loadfile' into 'next'
`loadfile` in Lua

See merge request STJr/SRB2!1615
2023-12-28 17:08:10 +00:00
LJ Sonic
c3f79a112f Add LUA_SetCFunctionField 2023-10-28 11:06:30 +02:00
LJ Sonic
d1dbdee016 Refactor global userdata registration 2023-10-28 00:24:04 +02:00
LJ Sonic
bc9a378521 Refactor userdata metatable registration 2023-10-27 20:17:27 +02:00
Alam Ed Arias
5693dcad44 Merge branch SRB2:next into loadfile 2023-10-25 19:50:55 +00:00
Gustaf Alhäll
2f2de7d3d3
Optimize field lookups in Lua metatables 2023-06-18 18:05:16 +02:00
spherallic
1470d099e3 Update copyright year & credits 2023-03-31 14:53:31 +02:00
Eidolon
366ee4ad92 Revert "Merge branch 'gamepad-refactor-lua-features' into 'next'"
This reverts commit 7f1cafcd3d, reversing
changes made to 696e2ab909.
2023-01-26 19:26:24 -06:00
Eidolon
6cc48a6e89 Revert "Merge branch 'gamepad-refactor-lua-rumble' into 'next'"
This reverts commit 7d8e8e20b7, reversing
changes made to 7f1cafcd3d.
2023-01-26 19:26:21 -06:00
Jaime Ita Passos
0516350bb4 Add haptic functions for Lua scripting 2022-11-14 01:52:20 -03:00
spherallic
14295ac7de 2022 2022-03-03 20:24:46 +01:00
GoldenTails
9441bafb09 Restructure the code to be able to possibly support loadfile. 2021-09-05 14:38:51 -05:00
James R
4d22b9f17f Merge remote-tracking branch 'origin/next' into hooklib-refactor 2021-06-07 18:12:52 -07:00
LJ Sonic
d325c7e6d3 The year is 2021 2021-05-07 17:45:56 +02:00
James R
aee963f4e9 Replace LUA_PushLightUserdata with LUA_PushUserdata
See 7df6a309 and 83a87042. I didn't realize that light
userdata's metatable is shared--like numbers or strings.
So it cannot be paired with a metatable.

I also made a few minor tweaks to Lua cvars, other than
accounting for the double pointer in the userdata.
2021-05-02 21:59:23 -07:00
James R
ed5a7f51e8 Revert "Merge branch 'lightmemedata' into 'next'"
This reverts commit d4c08a8410, reversing
changes made to e100f21dda.
2021-05-02 21:32:07 -07:00
James R
353692fa79 Merge remote-tracking branch 'origin/next' into hooklib-refactor 2020-12-16 08:43:49 -08:00
James R
8d382e49fb Big Large Lua Hooklib Refactor
* Hooks are no longer a mess of lua boiler plate. Helper functions reduce hooks
  to, at the most basic level, only two calls.
* Lua tables (the array part) are used to index hooks. Such tables contain only
  hooks of the same type.
* Hook types are defined in one place so you no longer need to sync up the enum
  and name array.
2020-12-10 00:36:41 -08:00
James R
314fd2783a Lua tag lists
Index and take length of tag lists like a table, 1-indexed. There are three
methods which may be used on tag lists:

list:iterate() - returns an iterator over the tags in the list
list:has(tag) - returns a boolean whether the tag is in the list
list.shares(list2) - returns whether two lists share a tag

"find" is also an alias to "has". Each method may be accessed from the global
taglist library too, e.g. taglist.iterate(list)

Tag lists may be compared with an equality operator too. This will tell you if
the two lists are composed of identical tags.

Accessible from sector.taglist, line.taglist and mapthing.taglist.
2020-12-04 13:53:27 -08:00
James R
621efbfa15 Lua taglib for accessing taggroups
The global "tags" can be iterated upon for every unique tag which is set in the
level. If a tag is set on a sector/line/thing, it will be included. Taking the
length of "tags" will give you the number of these unique tags. (If a tag is
set on multiple sectors/lines/things, it will only be counted once though.)

For sectors, lines and mapthings, call the field "tagged". This function takes
one argument, which is the tag. The return value can be iterated over for all
the sectors/lines/things with that tag. The length can also be taken for the
number of such objects. If no argument is given, the global tag is default.
2020-12-04 00:30:08 -08:00
Louis-Antoine
01124f2076 Fix Lua stacktrace not showing in various situations 2020-11-13 19:12:25 +01:00
LJ Sonic
6895d7df92 Merge branch 'next' into 'dofile'
# Conflicts:
#   src/lua_script.c
#   src/lua_script.h
2020-06-01 09:28:56 -04:00
Louis-Antoine
1bacaedde2 Show the traceback when a Lua script error happens 2020-05-30 20:24:33 +02:00
Louis-Antoine
1dbb755743 Add dofile() to Lua 2020-05-29 17:35:07 +02:00
James R
4eeae51cbb Merge branch 'more-lua-map-names' into 'next'
G_BuildMapTitle for Lua, G_BuildMapName outside of levels

See merge request STJr/SRB2!694
2020-05-19 23:13:35 -04:00
James R
d4c08a8410 Merge branch 'lightmemedata' into 'next'
Cvars returned by CV_FindVar did not work with userdataType

See merge request STJr/SRB2!754
2020-04-09 19:48:39 -04:00
Louis-Antoine
e3cbdf8fab Use HAVE_BLUA as fuel for my fireplace 2020-03-19 18:36:14 +01:00
James R
7060083db5 Update copyright year to 2020 2020-02-19 14:08:45 -08:00
James R
deaf5cfa28 LUA_PushLightUserdata takes the fun out of lib_cvFindVar 2020-02-02 15:19:19 -08:00
James R
7d5a8ac14b Allow G_BuildMapName outside of levels 2020-01-15 19:25:48 -08:00
Jaime Passos
5ebd84c3e7 Move ALL the Lua global variable stuff into lua_script.c. 2019-12-23 18:49:23 -03:00
Steel Titanium
d415cd5c6d
Update copyright date on source files 2019-12-06 13:49:42 -05:00
toaster
7bff305672 * Strip the word "function" from INLEVEL error messages, since they're now shared between access and function cases.
* Move it into lua_script.h, so it's available to everything that needs it.
2019-07-30 17:57:57 +01:00
mazmazz
075f28b7c8 WIP 20190101 merge
d_netcmd.c
filesrch.c
m_menu.c
p_setup.c
p_spec.c
r_data.c
r_main.c
r_things.c
w_wad.c
w_wad.h
2019-01-02 01:09:15 -05:00
mazmazz
ea7162a76a Update source copyrights to 2018 2018-11-25 07:35:38 -05:00
Monster Iestyn
1462c638cb Added the "lua_lumploading" variable for restricting certain Lua functions to lump load time only 2017-04-25 21:45:53 +01:00
Monster Iestyn
aa146dee41 Disabled all seg_t/node_t-related Lua code for now
To re-enable support for the above, uncomment the define HAVE_LUA_SEGS line in lua_script.h. Plain bbox userdata stuff is not disabled (though currently it's not used anyway)
2016-11-24 21:11:44 +00:00
Inuyasha
f07585191b copyright dates/statements updated and such
(no actual SLOC changes)
2016-05-17 17:42:11 -07:00
Inuyasha
3235351b99 And now Lua yells at you for doing what I just fixed 2016-05-11 14:33:50 -07:00
Alam Arias
771c1ecb8a Merge pull request #68 from Yukitty/revert-Lua-angles
Revert "Change angle_t handling in Lua."
2016-03-09 11:58:51 -05:00
JTE
54f95eb387 Revert "Change angle_t handling in Lua."
This partially reverts commit ef0e61fc33.
2016-03-09 08:38:10 -05:00
Inuyasha
cfcd7ce0d3 Readded EvalMath to Lua.
There is a caveat to this: The first time EvalMath is used, a
deprecated function warning will be shown to the user that tells
them to use _G[] instead.

This reverts commit 9d36cf37bd.
2016-03-08 22:15:26 -08:00
Yukita Mayako
9d6e75ae4f Cleanup LUAh_NetArchiveHook prototype mess. 2016-03-03 17:30:10 -05:00
Yukita Mayako
0af32ee2fa Move garbage collection out of Lua hooks.
That's supposed to be run once a frame, not once per hook
per mobj per frame you moron. If you just run it seven
thousand times a frame, of course your framerate will drop.
2015-06-10 13:42:45 -04:00
JTE
ef0e61fc33 Change LUA_NUMBER to fixed_t, change angle_t handling in Lua.
Angles now go from 0 to 0xFFFF (360 degrees == FRACUNIT) instead
of using a full UINT32. Lua only has one number type, so signedness
gets in the way of using angle_t directly. This handling of angles
matches up with how ZDoom ACS scripting and the like does it.

I also changed all the integer casts and pushes of fixed_t to
their own macro in preperation for possible future seperation.
2015-05-20 23:54:04 -04:00
Alam Ed Arias
02a3b0776c SRB2 2.1.7 release 2014-04-14 01:14:58 -04:00
Alam Ed Arias
b93cb1b65a SRB2 2.1 release 2014-03-15 13:11:35 -04:00