Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
ygopro-core
Commits
2fdba300
Commit
2fdba300
authored
Dec 15, 2021
by
mercury233
Committed by
GitHub
Dec 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update premake5 & basic support for lua5.4 (#417)
parent
d644fb5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
21 deletions
+32
-21
interpreter.cpp
interpreter.cpp
+11
-10
interpreter.h
interpreter.h
+0
-1
premake4.lua
premake4.lua
+0
-10
premake5.lua
premake5.lua
+21
-0
No files found.
interpreter.cpp
View file @
2fdba300
...
...
@@ -17,9 +17,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_state
=
luaL_newstate
();
current_state
=
lua_state
;
pduel
=
pd
;
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
no_action
=
0
;
call_depth
=
0
;
set_duel_info
(
lua_state
,
pd
);
//Initial
luaL_openlibs
(
lua_state
);
lua_pushnil
(
lua_state
);
...
...
@@ -577,12 +577,19 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
}
}
push_param
(
rthread
,
true
);
lua_State
*
prev_state
=
current_state
;
current_state
=
rthread
;
#if (LUA_VERSION_NUM >= 504)
int32
nresults
;
int32
result
=
lua_resume
(
rthread
,
prev_state
,
param_count
,
&
nresults
);
#else
int32
result
=
lua_resume
(
rthread
,
0
,
param_count
);
int32
nresults
=
lua_gettop
(
rthread
);
#endif
if
(
result
==
0
)
{
coroutines
.
erase
(
f
);
if
(
yield_value
)
{
if
(
lua_gettop
(
rthread
)
==
0
)
if
(
nresults
==
0
)
*
yield_value
=
0
;
else
if
(
lua_isboolean
(
rthread
,
-
1
))
*
yield_value
=
lua_toboolean
(
rthread
,
-
1
);
...
...
@@ -662,14 +669,8 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
return
ref
;
}
void
interpreter
::
set_duel_info
(
lua_State
*
L
,
duel
*
pduel
)
{
lua_pushlightuserdata
(
L
,
pduel
);
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
}
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
3
);
duel
*
pduel
=
(
duel
*
)
lua_topointer
(
L
,
-
1
);
lua_pop
(
L
,
1
);
duel
*
pduel
;
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
return
pduel
;
}
interpreter.h
View file @
2fdba300
...
...
@@ -69,7 +69,6 @@ public:
static
void
effect2value
(
lua_State
*
L
,
effect
*
peffect
);
static
void
function2value
(
lua_State
*
L
,
int32
pointer
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
void
set_duel_info
(
lua_State
*
L
,
duel
*
pduel
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
template
<
size_t
N
,
typename
...
TR
>
...
...
premake4.lua
deleted
100644 → 0
View file @
d644fb5b
project
"ocgcore"
kind
"StaticLib"
files
{
"**.cc"
,
"**.cpp"
,
"**.c"
,
"**.h"
}
configuration
"windows"
includedirs
{
"../lua"
}
configuration
"not vs*"
buildoptions
{
"-std=c++14"
}
configuration
"not windows"
includedirs
{
"/usr/include/lua5.3"
}
premake5.lua
0 → 100644
View file @
2fdba300
project
"ocgcore"
kind
"StaticLib"
files
{
"*.cpp"
,
"*.h"
}
links
{
"lua"
}
if
BUILD_LUA
then
includedirs
{
"../lua/src"
}
end
filter
"not action:vs*"
buildoptions
{
"-std=c++14"
}
filter
"system:bsd"
defines
{
"LUA_USE_POSIX"
}
filter
"system:macosx"
defines
{
"LUA_USE_MACOSX"
}
filter
"system:linux"
defines
{
"LUA_USE_LINUX"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment