raylib-lua icon indicating copy to clipboard operation
raylib-lua copied to clipboard

Trying to access struct internal variable

Open raysan5 opened this issue 8 years ago • 2 comments

Moved issue from https://github.com/raysan5/raylib/issues/204

When trying to use GenTextureMipmaps() in example text_ttf_loading.lua, it throws the following error:

ERROR: Lua Error: text_ttf_loading.lua:29: attempt to index a SpriteFont value (local 'font')

It seems it can not access the texture variable inside the SpriteFont struct.

raysan5 avatar Feb 08 '17 19:02 raysan5

(not sure if you're still working on this, but... :)

I'm pretty sure Lua is complaining that here:

font.texture = GenTextureMipmaps(font.texture)

you are ASSIGNING to the texture member of font; SpriteFont objects are read-only from Lua. Fortunately, as the mipmap generation is done in place, you don't have to assign to it, so GenTextureMipmaps(font.texture) would be enough.

ghassanpl avatar Oct 17 '17 01:10 ghassanpl

Hey @ghassanpl! Not working at the moment because I'm focused on raylib 1.8 but this side project is not abandoned! Thanks for the info! :)

raysan5 avatar Oct 17 '17 09:10 raysan5