raylib-lua
raylib-lua copied to clipboard
Trying to access struct internal variable
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.
(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.
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! :)