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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Neon
SRB2
Commits
7df6a309
Commit
7df6a309
authored
5 years ago
by
James R.
Browse files
Options
Downloads
Patches
Plain Diff
Lua CV_FindVar function
(cherry picked from commit b5746c231d17cd7b58c6b633e242d5ad26ad7017)
parent
e49d12b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua_consolelib.c
+21
-0
21 additions, 0 deletions
src/lua_consolelib.c
with
21 additions
and
0 deletions
src/lua_consolelib.c
+
21
−
0
View file @
7df6a309
...
...
@@ -427,6 +427,26 @@ static int lib_cvRegisterVar(lua_State *L)
return
1
;
}
static
int
lib_cvFindVar
(
lua_State
*
L
)
{
consvar_t
*
cv
;
if
((
cv
=
CV_FindVar
(
luaL_checkstring
(
L
,
1
))
))
{
lua_settop
(
L
,
1
);
/* We only want one argument in the stack. */
lua_pushlightuserdata
(
L
,
cv
);
/* Now the second value on stack. */
luaL_getmetatable
(
L
,
META_CVAR
);
/*
The metatable is the last value on the stack, so this
applies it to the second value, which is the cvar.
*/
lua_setmetatable
(
L
,
2
);
lua_pushvalue
(
L
,
2
);
return
1
;
}
else
return
0
;
}
// CONS_Printf for a single player
// Use 'print' in baselib for a global message.
static
int
lib_consPrintf
(
lua_State
*
L
)
...
...
@@ -466,6 +486,7 @@ static luaL_Reg lib[] = {
{
"COM_BufAddText"
,
lib_comBufAddText
},
{
"COM_BufInsertText"
,
lib_comBufInsertText
},
{
"CV_RegisterVar"
,
lib_cvRegisterVar
},
{
"CV_FindVar"
,
lib_cvFindVar
},
{
"CONS_Printf"
,
lib_consPrintf
},
{
NULL
,
NULL
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment