Thursday, 08 January 2009
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
January 08, 2009, 07:41:10 AM
Username: Password:
Login with username, password and session length

Forgot your password?
Text Functionality
DSLua Community
Welcome, Guest. Please login or register.
January 08, 2009, 07:41:10 AM
1724 Posts in 316 Topics by 10250 Members
Latest Member: monPyncloyalp
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Bugs & Suggestions  |  Text Functionality « previous next »
Pages: [1]
Author Topic: Text Functionality  (Read 956 times)
splattergnome
New Moon
*
Posts: 1


« on: April 17, 2006, 04:02:25 AM »

One thing I would love to see for DSLua would be text functionality - a command for displaying (or hiding) a keyboard and allow a text input (good for everything from highscores to whatever) - either "free text input", where people can deal with it as they wish, or a limited input or the like.

Also good would be commands for comparing text strings - do see if a certain string is within another string (and at what position) and other text manipulation commands (copying everything in a string from pos 1 to pos 2 into a new string 2, for example) - this would make *very* simple text games and the like possible (hangman?).

If simple text-based saving and loading of textfiles were possible, this would make dsLUA perfect... Wink

splatty
Logged
waruwaru
Administrator
Waxing Crescent
*****
Posts: 94


« Reply #1 on: April 17, 2006, 04:55:57 AM »

splattergnome wrote:
Quote
One thing I would love to see for DSLua would be text functionality - a command for displaying (or hiding) a keyboard and allow a text input (good for everything from highscores to whatever) - either "free text input", where people can deal with it as they wish, or a limited input or the like.


I might enable PA_Lib's default keyboard.  But it will take up some memory space, and I am not sure how well a default keyboard will interfere with user's graphics.  Right now, there is enough functionalities in DSLua to implement your own keyboard/input routines. Smiley

Quote

Also good would be commands for comparing text strings - do see if a certain string is within another string (and at what position) and other text manipulation commands (copying everything in a string from pos 1 to pos 2 into a new string 2, for example) - this would make *very* simple text games and the like possible (hangman?).


All string functions onthis page should work.  Here is a sample script:

Code:

-- set up screens for text output
SCREEN_BOTTOM   = 0
BGBotText = Screen.LoadTextBG()
Screen.Initialize( SCREEN_BOTTOM, BGBotText )

-- print various string function output
print( string.byte( "ABC" ) )
print( string.byte( "ABC", 2 ) )

-- test string find routine
print( string.find( "the quick brown fox", "quick" ) )
print( string.find( "the quick brown fox", "(%a+)" ) )
print( string.find( "the quick brown fox", "(%a+)", 10 ) )
print( string.find( "the quick brown fox", "fruit" ) )

-- some string sub functions
print( string.sub( "ABCDEF", 2, 3 ) )
print( string.sub( "ABCDEF", 3 ) )
print( string.sub( "ABCDEF", -1 ) )

-- test equality
if ( string.sub( "BAD", 2, 2 ) == "A" ) then
  print( "Equal" )
else
  print( "Not Equal" )
end

-- wait for a key press before exiting
DSLua.WaitForAnyKey()


Quote

If simple text-based saving and loading of textfiles were possible, this would make dsLUA perfect... Wink

splatty


I think some of the default Lua io functions are already working.  I havn't test them out yet.  It's something on my TODO list. Smiley

Enjoy!
Waruwaru
Logged
Pages: [1]
« previous next »
    Jump to:  



    (C) 2009 DSLua

    DSLua - Best scripting language for Nintendo DS home-brew!