FAQ Lua Errors

From PGE Wiki
Revision as of 11:07, 25 January 2015 by Kevsoft (talk | contribs) (Created page with "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 rath...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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
printText("Hello " + frame, 10, 100)
...


Right:

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