Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sphere
SRB2
Compare revisions
next to lua-local
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
spherallic/SRB2
Select target project
No results found
lua-local
Select Git revision
Branches
21-installer-nodd
64-gl-log
DJGPP
S_SKIN-missing-flag
appveyor
better-download
better-refusal
blend-locking
blentran
boost-tickrate
cleanup-opengl
cleanupmusicoptions
continue_tweaks
cppcheck-fixes
crawlacommander-sprites
cutscene-cleanup
dashmode-fixes
dd-music-bypass
dd-music-fix
delete-lua
delete-slopes
dofile
dropshadows-spawning
dynres
exchndl-xp-fix
fix-allowjoin
fix-ded-servers
fix-fire-shield
fix-input-buffer
fix-intermission-mouse
fix-keepbody-ping
fix-packet-name
fix-rollout-rock-crash
fix-spawn-desynch
fix-splitscreen
flipfuncpointers
flipfuncpointers-master
float-stepup
fof-lightlist-fixes
fuck-macros-1
g_findmap-lua
gamepad_experiments
gamepadtweaks
grr-lj
gtr-fixes
http-mserv
hu-chat-stuff
increase-input-buffer
increase-input-buffer-more
increase-packet-tics
input-display
input-display-translucency
io
join-delay
joystick-juggling-maz
keep-body
keycodes-only
ld413-mp-fix
libpng-version-support
lj-test
lol-states
long-names
lower-unpegged-fix
lua-hook-cleanup
lua-io
lua-local
makefile-tinkering
map-components-signedness-fixes
marathonmode
master
menu-cleanup
more-cleanup
musicdef-lua
netcode-tests
next
nexttest
nospinmovecut
opengl-blending-fix
optimise-archiving
parser-fixes
pictureformats
pictureformats-depth
pictureformats-software
pivot
prescott-march
public_flatsprite
ra-menus
realtics-is-stupid
reduced_palette
remove-glide
rendererversion
resend-gamestate
revert-d7b6a3dd
sal-oglshaderport
slope-cleanup
snake
software-clownery-mkii
strncpy-brullshit
test-next
thokker
Tags
SRB2_release_2.1
SRB2_release_2.1.1
SRB2_release_2.1.10
SRB2_release_2.1.11
SRB2_release_2.1.12
SRB2_release_2.1.14
SRB2_release_2.1.15
SRB2_release_2.1.16
SRB2_release_2.1.16a
SRB2_release_2.1.17
SRB2_release_2.1.18
SRB2_release_2.1.19
SRB2_release_2.1.2
SRB2_release_2.1.20
SRB2_release_2.1.21
SRB2_release_2.1.22
SRB2_release_2.1.23
SRB2_release_2.1.24
SRB2_release_2.1.25
SRB2_release_2.1.3
SRB2_release_2.1.4
SRB2_release_2.1.5
SRB2_release_2.1.6
SRB2_release_2.1.7
SRB2_release_2.1.8
SRB2_release_2.1.9
SRB2_release_2.2.0
SRB2_release_2.2.1
SRB2_release_2.2.2
SRB2_release_2.2.3
SRB2_release_2.2.4
td-release-v1.0.0
132 results
Swap
Target
STJr/SRB2
Select target project
STJr/SRB2
Sryder/SRB2
wolfy852/SRB2
Alpha2244/SRB2
Inuyasha/SRB2
yoshibot/SRB2
TehRealSalt/SRB2
PrisimaTF/SRB2
Hatninja/SRB2
SteelT/SRB2
james/SRB2
ShaderWraith/SRB2
SinnamonLat/SRB2
mazmazz_/SRB2
filpAM/SRB2
chaoloveicemdboy/SRB2
Whooa21/SRB2
Machturne/SRB2
Golden/SRB2
Tatsuru/SRB2
Snu/SRB2
Zwip-Zwap_Zapony/SRB2
fickleheart/SRB2
alphaRexJames/SRB2
JJK/SRB2
diskpoppy/SRB2
Hannu_Hanhi/SRB2
ZipperQR/SRB2
kays/SRB2
spherallic/SRB2
Zippy_Zolton/SRB2
namiishere/SRB2
Ors/SRB2
SMS_Alfredo/SRB2
sonic_edge/SRB2
lavla/SRB2
ashi/SRB2
X.organic/SRB2
Fafabis/SRB2
Meziu/SRB2
v-rob/SRB2
tertu/SRB2
bitten2up/SRB2
flarn2006/SRB2
Krabs/SRB2
clairebun/SRB2
Lactozilla/SRB2
thehackstack/SRB2
Spice/SRB2
win8linux/SRB2
JohnFrostFox/SRB2
talktoneon726/SRB2
Wane/SRB2
Lamibe/SRB2
spectrumuk2/srb-2
nerdyminer18/srb-2
256nil/SRB2
ARJr/SRB2
Alam/SRB2
Zenya/srb-2-marathon-demos
Acelite/srb-2-archivedmodifications
MIDIMan/SRB2
Lach/SRB2
Frostiikin/bounce-tweaks
Jaden/SRB2
Tyron/SRB2
Astronight/SRB2
Mari0shi06/SRB2
aiire/SRB2
Galactice/SRB2
srb2-ports/srb2-dreamcast
sdasdas/SRB2
chreas/srb-2-vr
StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
LoganAir/SRB2
NepDisk/srb-2
alufolie91/SRB2
Felicia.iso/SRB2
twi/SRB2
BarrelsOFun/SRB2
Speed2411/SRB2
Leather_Realms/SRB2
Ayemar/SRB2
Acelite/SRB2
VladDoc/SRB2
kaldrum/model-features
strawberryfox417/SRB2
Lugent/SRB2
Jisk/SRB2
Rem/SRB2
Refrag/SRB2
Henry_3230/srb-3230
TehPuertoRicanSpartan2/tprs-srb2
Leminn/srb-2-marathon-stuff
chromaticpipe2/SRB2
MiguelGustavo15/SRB2
Maru/srb-2-tests
SilicDev/SRB2
UnmatchedBracket/SRB2
HybridDog/SRB2
xordspar0/SRB2
jsjhbewfhh/SRB2
Fancy2209/SRB2
Lorsoen/SRB2
shindoukin/SRB2
GamerOfDays/SRB2
Craftyawesome/SRB2
tenshi-tensai-tennoji/SRB2
Scarfdudebalder/SRB2
luigi-budd/srb-2-fix-interplag-lockon
mskluesner/SRB2
johnpetersa19/SRB2
Pheazant/SRB2
chromaticpipe2/srb2classic
romoney5/SRB2
PAS/SRB2Classic
BlueStaggo/SRB2
117 results
next
Select Git revision
Branches
1392-2-2-15-attempting-to-draw-a-hud-graphic-with-the-same-lump-name-as-a-lua-script-crashes-the
21-installer-nodd
2210-pre1
2210-pre2
2210-rc1
2210-rc2
2210-rc3
2211-pre1
2211-pre2
2211-rc1
2212-pre1
2212-pre2
2212-pre3
2212-rc1
2213
2214-pre1
2214-pre2
2214-pre3
2214-pre4
2_2_12
64-gl-log
COM_ImmedExecute-lua
DJGPP
accel-momentum
acs
action-args
alpha-fixes
any-resolution
appveyor
blend-locking
blentran
blua-unary-not-fix
boost-tickrate
bustablesoundz
cleanup-opengl
cleanupmusic
clipmidtex
cmake-valgrind
crawlacommander-sprites
custom-map-names
custom-teams
cutscene-cleanup
dd-music-bypass
dd-music-fix
delfile2
deprecate-lua-dedicated-server
dpl-2
dropshadows-spawning
dynabsp
emblem-drawing
exchndl-xp-fix
extra-textures
few-kart-lua-changes
ffloorclip
fix-167
fix-cvar-conflicts
fix-opengl-parameter-crash
fix-opengl-shear-roll
flipfuncpointers
fof-lightlist-fixes
font-FUCK
frictionrefactor
fuck-macros-1
gamepad-luakeydown
gamepad-morefixes
gamepad_experiments
gametype-refactor
gametype-refactor-1
gametype-refactor-player-spawns
ghost-networking
gif-splitting
grr-lj
hitboxviewer
hwr-texture-cache-refactor
hwrender2
improve-439
increase-maxconditionsets
increase-packet-tics
input-display
input-display-translucency
io
joystick-juggling-maz
just-in-case
keycodes-only
ksf-wadfiles
ld413-mp-fix
levelstruct
libpng-version-support
linedef-actions
lj-test
lol-states
loopedsounds
lower-unpegged-fix
lua-change-gametype
lua-command-netids
lua-gfx-2
lua-gfx-sprites
lua-local
makefile-auto-mingw-gcc
makefile-tinkering
Tags
SRB2_release_2.1
SRB2_release_2.1.1
SRB2_release_2.1.10
SRB2_release_2.1.11
SRB2_release_2.1.12
SRB2_release_2.1.14
SRB2_release_2.1.15
SRB2_release_2.1.16
SRB2_release_2.1.16a
SRB2_release_2.1.17
SRB2_release_2.1.18
SRB2_release_2.1.19
SRB2_release_2.1.2
SRB2_release_2.1.20
SRB2_release_2.1.21
SRB2_release_2.1.22
SRB2_release_2.1.23
SRB2_release_2.1.24
SRB2_release_2.1.25
SRB2_release_2.1.3
SRB2_release_2.1.4
SRB2_release_2.1.5
SRB2_release_2.1.6
SRB2_release_2.1.7
SRB2_release_2.1.8
SRB2_release_2.1.9
SRB2_release_2.2.0
SRB2_release_2.2.1
SRB2_release_2.2.10
SRB2_release_2.2.11
SRB2_release_2.2.12
SRB2_release_2.2.13
SRB2_release_2.2.15
SRB2_release_2.2.2
SRB2_release_2.2.3
SRB2_release_2.2.4
SRB2_release_2.2.5
SRB2_release_2.2.6
SRB2_release_2.2.7
SRB2_release_2.2.8
SRB2_release_2.2.9
td-release-v1.0.0
142 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (7)
No memory leak please
· d96719da
James R.
authored
5 years ago
d96719da
Make implicit Lua global variables local
· 7ecaadba
James R.
authored
5 years ago
7ecaadba
Uhhhhhhhh
· cba8f77e
James R.
authored
5 years ago
cba8f77e
Remove the stupid implicit global warning that is now impossible to trigger
· ba542479
James R.
authored
5 years ago
ba542479
Lua 'global' keyword, only for functions for now because I'm tired
· db4dc101
James R.
authored
5 years ago
db4dc101
Make functions implicit local
· c097101e
James R.
authored
5 years ago
c097101e
Revert "Lua 'global' keyword, only for functions for now because I'm tired"
· ffbca6a6
James R.
authored
5 years ago
This reverts commit
db4dc101
.
ffbca6a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/blua/lparser.c
+31
-3
31 additions, 3 deletions
src/blua/lparser.c
src/lua_script.c
+11
-8
11 additions, 8 deletions
src/lua_script.c
with
42 additions
and
11 deletions
src/blua/lparser.c
View file @
ffbca6a6
...
...
@@ -24,6 +24,7 @@
#include
"lstate.h"
#include
"lstring.h"
#include
"ltable.h"
#include
"lvm.h"
...
...
@@ -1006,11 +1007,33 @@ static void poplhs (FuncState *fs) {
}
static
void
assignment
(
LexState
*
ls
)
{
static
void
implicitlocal
(
LexState
*
ls
,
expdesc
*
v
,
int
*
nvarsp
)
{
TValue
*
name
;
int
n
;
if
(
v
->
k
==
VGLOBAL
)
{
/* Overwriting this shouldn't matter as long as
I put it back, right? Right? :sweat_drops: */
StkId
old
=
ls
->
L
->
base
;
/* I tried to optimize this down as far as I could... */
name
=
&
ls
->
fs
->
f
->
k
[
v
->
u
.
s
.
info
];
/* global's name from singlevar */
luaV_gettable
(
ls
->
L
,
gt
(
ls
->
L
),
name
,
(
TValue
*
)
ls
->
L
->
base
);
if
(
ttisnil
(
ls
->
L
->
base
))
{
/* james: if global don't exist, make local */
n
=
(
*
nvarsp
)
++
;
new_localvar
(
ls
,
rawtsvalue
(
name
),
n
);
/* can't forget to enumerate it as local! */
v
->
k
=
VLOCAL
;
v
->
u
.
s
.
info
=
ls
->
fs
->
nactvar
+
n
;
}
ls
->
L
->
base
=
old
;
}
}
static
void
assignment
(
LexState
*
ls
,
int
*
nvarsp
)
{
expdesc
e
;
expdesc_list
*
lh
=
ls
->
fs
->
lhs
;
check_condition
(
ls
,
VLOCAL
<=
lh
->
v
.
k
&&
lh
->
v
.
k
<=
VINDEXED
,
"syntax error"
);
implicitlocal
(
ls
,
&
lh
->
v
,
nvarsp
);
if
(
testnext
(
ls
,
','
))
{
/* assignment -> `,' primaryexp assignment */
expdesc_list
nv
;
nv
.
prev
=
lh
;
...
...
@@ -1020,7 +1043,7 @@ static void assignment (LexState *ls) {
luaY_checklimit
(
ls
->
fs
,
ls
->
fs
->
nrhs
,
LUAI_MAXCCALLS
-
ls
->
L
->
nCcalls
,
"variables in assignment"
);
pushlhs
(
ls
->
fs
,
&
nv
);
assignment
(
ls
);
assignment
(
ls
,
nvarsp
);
poplhs
(
ls
->
fs
);
}
else
{
/* assignment -> `=' explist1 */
...
...
@@ -1348,6 +1371,7 @@ static void localstat (LexState *ls) {
static
int
funcname
(
LexState
*
ls
,
expdesc
*
v
)
{
/* funcname -> NAME {field} [`:' NAME] */
int
needself
=
0
;
int
nvars
=
0
;
singlevar
(
ls
,
v
);
while
(
ls
->
t
.
token
==
'.'
)
field
(
ls
,
v
);
...
...
@@ -1355,6 +1379,8 @@ static int funcname (LexState *ls, expdesc *v) {
needself
=
1
;
field
(
ls
,
v
);
}
implicitlocal
(
ls
,
v
,
&
nvars
);
adjustlocalvars
(
ls
,
nvars
);
return
needself
;
}
...
...
@@ -1375,6 +1401,7 @@ static void exprstat (LexState *ls) {
/* stat -> func | assignment */
FuncState
*
fs
=
ls
->
fs
;
expdesc_list
v
;
int
nvars
=
0
;
primaryexp
(
ls
,
&
v
.
v
);
if
(
v
.
v
.
k
==
VCALL
)
/* stat -> func */
SETARG_C
(
getcode
(
fs
,
&
v
.
v
),
1
);
/* call statement uses no results */
...
...
@@ -1382,10 +1409,11 @@ static void exprstat (LexState *ls) {
v
.
prev
=
NULL
;
lua_assert
(
ls
->
fs
->
lhs
==
NULL
&&
ls
->
fs
->
nlhs
==
0
&&
ls
->
fs
->
nrhs
==
0
);
pushlhs
(
ls
->
fs
,
&
v
);
assignment
(
ls
);
assignment
(
ls
,
&
nvars
);
poplhs
(
ls
->
fs
);
ls
->
fs
->
nrhs
=
0
;
lua_assert
(
ls
->
fs
->
lhs
==
NULL
&&
ls
->
fs
->
nlhs
==
0
);
adjustlocalvars
(
ls
,
nvars
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/lua_script.c
View file @
ffbca6a6
...
...
@@ -316,20 +316,19 @@ static int setglobals(lua_State *L)
const
char
*
csname
;
char
*
name
;
lua_remove
(
L
,
1
);
// we're not gonna be using _G
csname
=
lua_tostring
(
L
,
1
);
csname
=
lua_tostring
(
L
,
2
);
// make an uppercase copy of the name
name
=
Z_StrDup
(
csname
);
strupr
(
name
);
if
(
fastncmp
(
name
,
"A_"
,
2
)
&&
lua_isfunction
(
L
,
2
))
if
(
fastncmp
(
name
,
"A_"
,
3
)
&&
lua_isfunction
(
L
,
3
))
{
// Accept new A_Action functions
// Add the action to Lua actions refrence table
lua_getfield
(
L
,
LUA_REGISTRYINDEX
,
LREG_ACTIONS
);
lua_pushstring
(
L
,
name
);
// "A_ACTION"
lua_pushvalue
(
L
,
2
);
// function
lua_pushvalue
(
L
,
3
);
// function
lua_rawset
(
L
,
-
3
);
// rawset doesn't trigger this metatable again.
// otherwise we would've used setfield, obviously.
...
...
@@ -337,11 +336,15 @@ static int setglobals(lua_State *L)
return
0
;
}
if
(
LUA_CheckGlobals
(
L
,
csname
))
return
0
;
Z_Free
(
name
);
return
luaL_error
(
L
,
"Implicit global "
LUA_QS
" prevented. Create a local variable instead."
,
csname
);
if
(
!
LUA_CheckGlobals
(
L
,
csname
))
{
lua_settop
(
L
,
3
);
lua_rawset
(
L
,
1
);
}
return
0
;
}
// Clear and create a new Lua state, laddo!
...
...
This diff is collapsed.
Click to expand it.