I have a table with some text that I use as instructions (lua module). So depending on the progress of the player my gui script will choose a specific text instruction from my table. One of the text includes a variable from another lua module. But it seems like my variable stay 0 when I update the variable and set the text of the node.
Example:
local player = require("lib.player")
local M = {}
M.INSTRUCTIONS =
{
--tutorial
{text = "Instruction 1"},
{text = "Instruction 2"},
{text = "Instruction 3"},
--game
{text = "Tap to Start!"},
{text = "Try to beat your Highscore:\n" .. player.highscore_ref}
}
return M
When I update the player.highscore_ref variable and set the text, the text always gives me player.highscore_ref variable as 0. Why is this?
So it will always be:
Try to beat your Highscore: 0