Skip to content

Commit

Permalink
Fix the map.level method
Browse files Browse the repository at this point in the history
  • Loading branch information
dwursteisen committed Nov 20, 2023
1 parent 611e869 commit a240538
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,21 @@ class MapLib(private val resourceAccess: GameResourceAccess, private val spriteS

@TinyFunction("Set the current level to use.")
inner class level : OneArgFunction() {
@TinyCall("Return the index of the current level.")
override fun call(): LuaValue {
return super.call()
}

@TinyCall(
"Set the current level to use. " +
"The level can be an index or the id defined by LDTK. " +
"Return the previous index level.",
)
override fun call(@TinyArg("level") arg: LuaValue): LuaValue {
if (arg.isnil()) return valueOf(currentLevel)

val prec = currentLevel
currentLevel = if (arg.isstring()) {
currentLevel = if (!arg.isnumber()) {
var index = 0
var found = false
var level = resourceAccess.level(index)
Expand Down

0 comments on commit a240538

Please sign in to comment.