Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2003
    Posts
    712

    Post Function: Convert boolean value to string

    Copy/Paste the following code into your global functions and call the function whenever you need to convert a value from a boolean to a string. This is especially useful when you don't know what type the variable in question contains, for example if you are traversing through a table containing both boolean and non-boolean variables.

    Global Function Code:
    Code:
    function BoolToString(value)
    	if type(value) == "boolean" then
    	-- The value is of type boolean
    		if value then
    		-- The boolean value is true, return string "True"
    			return "True";
    		else
    		-- The boolean value is false, return string "False"
    			return "False";
    		end
    	else
    	-- The value is not of type boolean, return unchanged value
    		return value;
    	end
    end
    Function Call (from any event):
    Code:
    New_Value = BoolToString(Old_Value);
    Last edited by Desmond; 05-07-2004 at 01:37 PM.

Similar Threads

  1. Wallpaper function
    By TJ_Tigger in forum AutoPlay Media Studio 5.0
    Replies: 14
    Last Post: 06-28-2004, 10:05 AM
  2. "Get Delimited String" -- Delimiter can be a string?
    By Bishal in forum Setup Factory 6.0
    Replies: 1
    Last Post: 10-16-2003, 10:40 AM
  3. replace a character in a string
    By boudie in forum Setup Factory 6.0
    Replies: 7
    Last Post: 06-10-2003, 08:48 AM
  4. While loop in a string
    By Option_Explicit in forum AutoPlay Media Studio 4.0
    Replies: 4
    Last Post: 03-04-2003, 07:10 AM
  5. Calling DLL Functions with string return values
    By DanKerns in forum Setup Factory 6.0
    Replies: 3
    Last Post: 11-08-2002, 02:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts