Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
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
Operate
Environments
Monitor
Incidents
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
Otowa Kotori
Tales of MajEyal
Commits
7633f522
Commit
7633f522
authored
6 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
0837a0d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/engines/default/engine/utils.lua
+14
-14
14 additions, 14 deletions
game/engines/default/engine/utils.lua
src/core_lua.c
+12
-0
12 additions, 0 deletions
src/core_lua.c
with
26 additions
and
14 deletions
game/engines/default/engine/utils.lua
+
14
−
14
View file @
7633f522
...
@@ -128,41 +128,41 @@ end
...
@@ -128,41 +128,41 @@ end
function
table
.
print_shallow
(
src
,
offset
,
line_feed
)
function
table
.
print_shallow
(
src
,
offset
,
line_feed
)
if
not
line_feed
then
line_feed
=
'
\n
'
end
if
not
line_feed
then
line_feed
=
'
\n
'
end
if
type
(
src
)
~=
"table"
then
io
.stdout
:
write
(
"table.print has no table:"
,
src
)
io
.stdout
:
write
(
line_feed
)
return
end
if
type
(
src
)
~=
"table"
then
core
.
game
.
stdout
_
write
(
"table.print has no table:"
,
src
)
core
.
game
.
stdout
_
write
(
line_feed
)
return
end
offset
=
offset
or
""
offset
=
offset
or
""
for
k
,
e
in
pairs
(
src
)
do
for
k
,
e
in
pairs
(
src
)
do
io
.stdout
:
write
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
core
.
game
.
stdout
_
write
(
line_feed
)
end
end
end
end
function
table
.
print
(
src
,
offset
,
line_feed
)
function
table
.
print
(
src
,
offset
,
line_feed
)
if
not
line_feed
then
line_feed
=
'
\n
'
end
if
not
line_feed
then
line_feed
=
'
\n
'
end
if
type
(
src
)
~=
"table"
then
io
.stdout
:
write
(
"table.print has no table:"
,
src
)
io
.stdout
:
write
(
line_feed
)
return
end
if
type
(
src
)
~=
"table"
then
core
.
game
.
stdout
_
write
(
"table.print has no table:"
,
src
)
core
.
game
.
stdout
_
write
(
line_feed
)
return
end
offset
=
offset
or
""
offset
=
offset
or
""
for
k
,
e
in
pairs
(
src
)
do
for
k
,
e
in
pairs
(
src
)
do
-- Deep copy subtables, but not objects!
-- Deep copy subtables, but not objects!
if
type
(
e
)
==
"table"
and
not
e
.
__ATOMIC
and
not
e
.
__CLASSNAME
then
if
type
(
e
)
==
"table"
and
not
e
.
__ATOMIC
and
not
e
.
__CLASSNAME
then
io
.stdout
:
write
((
"%s[%s] = {"
):
format
(
offset
,
tostring
(
k
)))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s[%s] = {"
):
format
(
offset
,
tostring
(
k
)))
core
.
game
.
stdout
_
write
(
line_feed
)
table
.
print
(
e
,
offset
..
" "
,
line_feed
)
table
.
print
(
e
,
offset
..
" "
,
line_feed
)
io
.stdout
:
write
((
"%s}"
):
format
(
offset
))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s}"
):
format
(
offset
))
core
.
game
.
stdout
_
write
(
line_feed
)
else
else
io
.stdout
:
write
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
core
.
game
.
stdout
_
write
(
line_feed
)
end
end
end
end
end
end
function
table
.
iprint
(
src
,
offset
,
line_feed
)
function
table
.
iprint
(
src
,
offset
,
line_feed
)
if
not
line_feed
then
line_feed
=
'
\n
'
end
if
not
line_feed
then
line_feed
=
'
\n
'
end
if
type
(
src
)
~=
"table"
then
io
.stdout
:
write
(
"table.iprint has no table:"
,
src
)
io
.stdout
:
write
(
line_feed
)
return
end
if
type
(
src
)
~=
"table"
then
core
.
game
.
stdout
_
write
(
"table.iprint has no table:"
,
src
)
core
.
game
.
stdout
_
write
(
line_feed
)
return
end
offset
=
offset
or
""
offset
=
offset
or
""
for
k
,
e
in
ipairs
(
src
)
do
for
k
,
e
in
ipairs
(
src
)
do
-- Deep copy subtables, but not objects!
-- Deep copy subtables, but not objects!
if
type
(
e
)
==
"table"
and
not
e
.
__ATOMIC
and
not
e
.
__CLASSNAME
then
if
type
(
e
)
==
"table"
and
not
e
.
__ATOMIC
and
not
e
.
__CLASSNAME
then
io
.stdout
:
write
((
"%s[%s] = {"
):
format
(
offset
,
tostring
(
k
)))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s[%s] = {"
):
format
(
offset
,
tostring
(
k
)))
core
.
game
.
stdout
_
write
(
line_feed
)
table
.
print
(
e
,
offset
..
" "
)
table
.
print
(
e
,
offset
..
" "
)
io
.stdout
:
write
((
"%s}"
):
format
(
offset
))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s}"
):
format
(
offset
))
core
.
game
.
stdout
_
write
(
line_feed
)
else
else
io
.stdout
:
write
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
io
.stdout
:
write
(
line_feed
)
core
.
game
.
stdout
_
write
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
core
.
game
.
stdout
_
write
(
line_feed
)
end
end
end
end
end
end
...
@@ -170,11 +170,11 @@ end
...
@@ -170,11 +170,11 @@ end
function
tprint
(
...
)
function
tprint
(
...
)
local
args
=
{
...
}
local
args
=
{
...
}
for
i
,
str
in
ipairs
(
args
)
do
for
i
,
str
in
ipairs
(
args
)
do
if
type
(
str
)
==
"table"
then
io
.stdout
:
write
(
'{ '
)
table
.
print
(
str
,
nil
,
', '
)
io
.stdout
:
write
(
' }'
)
if
type
(
str
)
==
"table"
then
core
.
game
.
stdout
_
write
(
'{ '
)
table
.
print
(
str
,
nil
,
', '
)
core
.
game
.
stdout
_
write
(
' }'
)
else
io
.stdout
:
write
(
tostring
(
str
))
end
else
core
.
game
.
stdout
_
write
(
tostring
(
str
))
end
if
i
<
#
args
then
io
.stdout
:
write
(
'
\t
'
)
end
if
i
<
#
args
then
core
.
game
.
stdout
_
write
(
'
\t
'
)
end
end
end
io
.stdout
:
write
(
'
\n
'
)
core
.
game
.
stdout
_
write
(
'
\n
'
)
end
end
--- Generate a containing indexes between a and b and set to value v
--- Generate a containing indexes between a and b and set to value v
...
...
This diff is collapsed.
Click to expand it.
src/core_lua.c
+
12
−
0
View file @
7633f522
...
@@ -608,6 +608,17 @@ static int lua_disable_connectivity(lua_State *L)
...
@@ -608,6 +608,17 @@ static int lua_disable_connectivity(lua_State *L)
return
0
;
return
0
;
}
}
static
int
lua_stdout_write
(
lua_State
*
L
)
{
int
i
=
1
;
while
(
i
<=
lua_gettop
(
L
))
{
const
char
*
s
=
lua_tostring
(
L
,
i
);
printf
(
"%s"
,
s
);
i
++
;
}
return
0
;
}
static
int
lua_open_browser
(
lua_State
*
L
)
static
int
lua_open_browser
(
lua_State
*
L
)
{
{
#if defined(SELFEXE_LINUX) || defined(SELFEXE_BSD)
#if defined(SELFEXE_LINUX) || defined(SELFEXE_BSD)
...
@@ -647,6 +658,7 @@ static const struct luaL_Reg gamelib[] =
...
@@ -647,6 +658,7 @@ static const struct luaL_Reg gamelib[] =
{
"checkError"
,
lua_check_error
},
{
"checkError"
,
lua_check_error
},
{
"resetLocale"
,
lua_reset_locale
},
{
"resetLocale"
,
lua_reset_locale
},
{
"openBrowser"
,
lua_open_browser
},
{
"openBrowser"
,
lua_open_browser
},
{
"stdout_write"
,
lua_stdout_write
},
{
"disableConnectivity"
,
lua_disable_connectivity
},
{
"disableConnectivity"
,
lua_disable_connectivity
},
{
NULL
,
NULL
},
{
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