Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
error: String compatibility.lua - Gideros Forum

error: String compatibility.lua

simransimran Member
edited May 2014 in General questions
in function 'func'
[string "compatibility.lua"]:32: in function <[string "compatibility.lua"]:31>

I have this piece of code and as soon as the text is displayed, it gives me the above mentioned error:

function youLoose()
local font2 = TTFont.new("billo.ttf", 20, " 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
LooserText = TextField.new(font2, "You Loose :p :P , Try AGAIN?")
LooserText:setPosition(100, 100)
stage:addChild(LooserText)
Timer = Timer.delayedCall(1000, removing)
end

function removing()
LooserText:getParent():removeChild(LooserText)
end
stage: addEventListener(Event.ENTER_FRAME, onEnter)

Comments

  • ar2rsawseenar2rsawseen Maintainer
    @simran was there anything else to the error?
    And if you comment out stage:addChild call does the error still happen?

    Also don't override Timer class, as you won't be able to use it anymore
  • simransimran Member
    @ar2rsawseen: If I remove stage: addChild, the error does no happen, but neither does text show up, so how am I supposed to render text? and yes, I changed Timer to timer, I thbk, that's what you meant that i shall not be overriding timer class , right?
  • ar2rsawseenar2rsawseen Maintainer
    interesting, but I really don't know what it could have to do with it.

    Are you sure you are not overriding LooserText somewhere else in the code to being some other value?

    Another point that I noticed, that you provide cached symbols to TTFont, and then you use smilies and punctuation which are not provided as cached symbols, but this again most probably won't produce the error.

    Is it really no more error text in there?

    Can you prepare smallest example possible replicating the error and post here?
  • simransimran Member
    Yes, I added those cached symbols later on, the symbols which I did not cache were just missing and rendered when I later added them to the cache.
    Sure, I will just post the concise example for the same with the exact error message.
  • YanYan Member
    I have the same error a very long time
    Process: ru.artnode.smashed, PID: 10861
        com.giderosmobile.android.player.LuaException: Invalid font size.
        stack traceback:
        	core/Text.lua:6: in function 'init'
        	[string "property.lua"]:52: in function '__new'
        	[string "property.lua"]:59: in function 'new'
        	app/interface/levelfail.lua:37: in function 'init'
        	[string "property.lua"]:52: in function '__new'
        	[string "property.lua"]:59: in function 'new'
        	core/Level.lua:416: in function 'showLevelFail'
        	core/Level.lua:188: in function 'func'
        	[string "compatibility.lua"]:32: in function <[string "compatibility.lua"]:31>
            at LUA.init(coreText.lua:6)
            at LUA.__new(string_property.lua:52)
            at LUA.new(string_property.lua:59)
            at LUA.init(appinterfacelevelfail.lua:37)
            at LUA.__new(string_property.lua:52)
            at LUA.new(string_property.lua:59)
            at LUA.showLevelFail(coreLevel.lua:416)
            at LUA.func(coreLevel.lua:188)
            at LUA.string_compatibilitylua31(string_compatibility.lua:32)
    Text = Core.class(Sprite)
     
    function Text:init(value, font, size, color, substrate, filter, anchor)
     
    	local filter	= filter or false
    	local font		= TTFont.new(font, size, filter)
    	local color		= color or 0x000000
    	local initVal	= value or '<a href="/profile/%27">@'</a>
     
    	self.anchor		= anchor or 0.5
     
    	self.text		= TextField.new(font, value, initVal)
     
    	self.text:setTextColor(color)
     
    	if substrate then
     
    		local sub = Bitmap.new(Texture.new(substrate[1], true))
     
    		if substrate[2] then
     
    			self.anchor = 0
    			self.text:setX(substrate[2])
     
    		end
     
    		if substrate[3] then
     
    			self.text:setY(substrate[3])
     
    		end
     
    		sub:setAnchorPoint(self.anchor, 0.5)
    		self.text:setAnchorPoint(self.anchor, 0.5)
     
     
    		self:addChild(sub)
     
    	end
     
    	self:addChild(self.text)
     
    end
     
    function Text:getLength()
     
    	return string.len(self.text:getText())
     
    end
     
    function Text:setText(text)
     
    	self.value = text
     
    	self.text:setText(text)
    	self.text:setAnchorPoint(self.anchor, 0.5)
     
    end
     
    function Text:getText()
     
    	return self.value
     
    end
    vk.com/yan_alex
Sign In or Register to comment.