FAQ Lua Errors

From PGE Wiki
Jump to navigation Jump to search

This page should help developers to fix their lua errors.

Runtime Errors

No static 'something' in class 'Player'

This happens if you use the Player-class rather than the player-object.
Wrong:

...
Player.x = 5
...


Right:

...
player.x = 5
...

or create your own Player-object:

myPlayer = Player()
...
myPlayer.x = 5
...

Attempt to perform arithmetic on a string value

This is probably one of the most beginner mistakes. Concating two string is done with ".." instead of "+".
Wrong:

...
local frame = 5
Text.print("Hello " + frame, 10, 100)
...


Right:

...
local frame = 5
Text.print("Hello "..frame, 10, 100)
...