Tuesday, 02 December 2008
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
December 02, 2008, 09:20:28 AM
Username: Password:
Login with username, password and session length

Forgot your password?
Problem with patterns and loops
DSLua Community
Welcome, Guest. Please login or register.
December 02, 2008, 09:20:28 AM
1723 Posts in 315 Topics by 6338 Members
Latest Member: Driennaunmand
DSLua Community  |  General DS Programming Chats  |  Code Hashing  |  Problem with patterns and loops « previous next »
Pages: [1]
Author Topic: Problem with patterns and loops  (Read 917 times)
Samji
New Moon
*
Posts: 6


« on: February 10, 2008, 05:18:45 PM »

I'm having problems with these programs. That is they refuse to run.

Code:
SCREEN_TOP = 1
SCREEN_BOTTOM = 0
BGTopText = Screen.LoadTextBG()
BGBotText = Screen.LoadTextBG()
Screen.Initialize(SCREEN_TOP, BGTopText)
Screen.Initialize(SCREEN_BOTTOM, BGBotText)

fruit = "apple,pear,banana,pineapple"
basket = {}
i = 1
for v in string.gmatch(fruit, "%w+") do
    basket[i] = v
    i = i + 1
end
-- I needs a nice, fruity drink...
message = "What about a nice " .. fruit[3] .. "?"
BGBotText:PrintXY(5, 12, message)
DSLua.WaitForAnyKey()
Code:
-- set up the screens to display text
SCREEN_TOP = 1
SCREEN_BOTTOM = 0
BGTopText = Screen.LoadTextBG() BGBotText = Screen.LoadTextBG()
Screen.Initialize(SCREEN_TOP, BGTopText)
Screen.Initialize(SCREEN_BOTTOM, BGBotText)

text = "%match this#"
match = string.match(text, "[%w%s]+")

BGTopText:PrintXY(10, 12, match)

-- wait for any key press
DSLua.WaitForAnyKey()

Any ideas? Thanks.
Logged
Pages: [1]
« previous next »
    Jump to:  



    (C) 2008 DSLua

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