Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
retro8
Commits
c0bb18d0
Commit
c0bb18d0
authored
Dec 23, 2019
by
Jack
Browse files
working coroutine support with lua_loadlibs
parent
5791b3ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
projects/vs2017/retro8/api.lua
View file @
c0bb18d0
...
@@ -61,8 +61,9 @@ function yield()
...
@@ -61,8 +61,9 @@ function yield()
coroutine.yield
()
coroutine.yield
()
end
end
function
coresume
(
f
,
...
)
-- TODO: missing vararg
coroutine.resume
(
f
,
table.unpack
(
arg
))
function
coresume
(
f
)
coroutine.resume
(
f
)
end
end
function
costatus
()
function
costatus
()
...
...
src/lua/linit.c
View file @
c0bb18d0
...
@@ -41,15 +41,15 @@
...
@@ -41,15 +41,15 @@
*/
*/
static
const
luaL_Reg
loadedlibs
[]
=
{
static
const
luaL_Reg
loadedlibs
[]
=
{
{
"_G"
,
luaopen_base
},
{
"_G"
,
luaopen_base
},
{
LUA_LOADLIBNAME
,
luaopen_package
},
//
{LUA_LOADLIBNAME, luaopen_package},
{
LUA_COLIBNAME
,
luaopen_coroutine
},
{
LUA_COLIBNAME
,
luaopen_coroutine
},
{
LUA_TABLIBNAME
,
luaopen_table
},
{
LUA_TABLIBNAME
,
luaopen_table
},
{
LUA_IOLIBNAME
,
luaopen_io
},
//
{LUA_IOLIBNAME, luaopen_io},
{
LUA_OSLIBNAME
,
luaopen_os
},
//
{LUA_OSLIBNAME, luaopen_os},
{
LUA_STRLIBNAME
,
luaopen_string
},
//
{LUA_STRLIBNAME, luaopen_string},
{
LUA_MATHLIBNAME
,
luaopen_math
},
//
{LUA_MATHLIBNAME, luaopen_math},
{
LUA_UTF8LIBNAME
,
luaopen_utf8
},
//
{LUA_UTF8LIBNAME, luaopen_utf8},
{
LUA_DBLIBNAME
,
luaopen_debug
},
//
{LUA_DBLIBNAME, luaopen_debug},
#if defined(LUA_COMPAT_BITLIB)
#if defined(LUA_COMPAT_BITLIB)
{
LUA_BITLIBNAME
,
luaopen_bit32
},
{
LUA_BITLIBNAME
,
luaopen_bit32
},
#endif
#endif
...
...
src/vm/lua_bridge.cpp
View file @
c0bb18d0
...
@@ -943,9 +943,10 @@ void Code::loadAPI()
...
@@ -943,9 +943,10 @@ void Code::loadAPI()
L
=
luaL_newstate
();
L
=
luaL_newstate
();
}
}
luaopen_base
(
L
);
luaL_openlibs
(
L
);
/*luaopen_base(L);
luaopen_table(L);
luaopen_table(L);
luaopen_coroutine
(
L
);
luaopen_coroutine(L);
*/
std
::
ifstream
apiFile
(
"api.lua"
);
std
::
ifstream
apiFile
(
"api.lua"
);
std
::
string
api
((
std
::
istreambuf_iterator
<
char
>
(
apiFile
)),
std
::
istreambuf_iterator
<
char
>
());
std
::
string
api
((
std
::
istreambuf_iterator
<
char
>
(
apiFile
)),
std
::
istreambuf_iterator
<
char
>
());
...
...
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