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
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
0b7f8ca3
Commit
0b7f8ca3
authored
4 years ago
by
MascaraSnake
Browse files
Options
Downloads
Plain Diff
Merge branch 'lua-mapthing-len' into 'next'
Lua mapthing len See merge request
!957
parents
7722d41b
4b7f0f49
No related branches found
No related tags found
2 merge requests
!985
Shaders next merge
,
!957
Lua mapthing len
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua_mobjlib.c
+12
-0
12 additions, 0 deletions
src/lua_mobjlib.c
with
12 additions
and
0 deletions
src/lua_mobjlib.c
+
12
−
0
View file @
0b7f8ca3
...
...
@@ -829,6 +829,15 @@ static int mapthing_set(lua_State *L)
return
0
;
}
static
int
mapthing_num
(
lua_State
*
L
)
{
mapthing_t
*
mt
=
*
((
mapthing_t
**
)
luaL_checkudata
(
L
,
1
,
META_MAPTHING
));
if
(
!
mt
)
return
luaL_error
(
L
,
"accessed mapthing_t doesn't exist anymore."
);
lua_pushinteger
(
L
,
mt
-
mapthings
);
return
1
;
}
static
int
lib_iterateMapthings
(
lua_State
*
L
)
{
size_t
i
=
0
;
...
...
@@ -893,6 +902,9 @@ int LUA_MobjLib(lua_State *L)
lua_pushcfunction
(
L
,
mapthing_set
);
lua_setfield
(
L
,
-
2
,
"__newindex"
);
lua_pushcfunction
(
L
,
mapthing_num
);
lua_setfield
(
L
,
-
2
,
"__len"
);
lua_pop
(
L
,
1
);
lua_newuserdata
(
L
,
0
);
...
...
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