Can’t do that?
local tmpClass = “assets/Sprites/”…my_player_class
sheetData = require tmpClass
[import]uid: 111106 topic_id: 19538 reply_id: 319538[/import]
If you post an actual question with actual details on what you are trying to do and what the outcome really is then somebody might be able to help you. If you don’t put a bit of effort into explaining your problem properly, no one is going to put effort into helping you. [import]uid: 61899 topic_id: 19538 reply_id: 75973[/import]
@CluelessIdeas
I’m living in Korea and most people’s english language skills are very basic. When forced to write or speak in english, it usually comes out in very basic form. A lot like what I see here, so I’m guessing that the OP is not comfortable with english.
@Juanluis.suarez
I think I see your problem. You forgot the parenthesis “( )”.
Also make sure that the value stored in the variable my\_player\_class
doesn’t have “.lua”
Try this instead:
[lua]-- Please note:
– correct: my_player_class = “someModule”
– not correct: my_player_class = “someModule.lua”
local tmpClass = “assets/Sprites/”…my_player_class
sheetData = require(tmpClass);[/lua]
[import]uid: 70847 topic_id: 19538 reply_id: 75974[/import]
Yes, i’m sorry, my native language is spanish/portuguese, not english
Sorry my poor english…
What i’m trying to do is to change spriteSheet/spriteData dinamically when player select a class, and it seems it can’t be do it.
I’ve tried that too @ingemar with no success. Thanks for your help.
local tmpClass = “assets/Sprites/”…my_player_class
sheetData = require(tmpClass)
[import]uid: 111106 topic_id: 19538 reply_id: 75976[/import]
What error are you getting if you run this in the simulator? [import]uid: 70847 topic_id: 19538 reply_id: 75979[/import]
my_player_class is a string right?
and without filetypes?
Set the variable as a static string (so you know what it is) and run it (get some print()'s in there too!) [import]uid: 79135 topic_id: 19538 reply_id: 75981[/import]
It’s not a problem if you don’t speak/write english very well, but it is a problem if you don’t explain better what you are trying to do. If we don’t know exactly what’s going on and what you want it’s difficult to help.
Without the error message it’s very hard to know where the problem may be. What’s the value of my_player_class? How about printing tmpClass to see if you are introducing extra/wrong characters somewhere along the way. Is it failing in the simulator or device or both?
Right now print() is practically the only debugging tool available, so use it extensively to see what is going on whenever you have problems. [import]uid: 61899 topic_id: 19538 reply_id: 75986[/import]