LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-18-2006, 02:59 PM   #1
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Question Gambas: Null Object


I've got a bit of a problem:

In Gambas, I'm trying to define an array in a separate class called "global" (it's an array that needs global availability). For all the documentation I've read, I should declare it like so:

Code:
STATIC PUBLIC array_x AS String[]
The moment a subroutine from any other class thinks of assigning an array element a value, I get a "Null Object" error.

I should be able to assign an element a value by doing the following (assuming I'm doing the assignment outside of the class array_x is defined in):
Code:
global.array_x[5] = "hullabaloo"
Any suggestions?

Do I need to assign any values in the class in which "array_x" is defined?
 
Old 05-19-2006, 08:11 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
I suspect that your array has not been allocated any elements, hence the problem when you try and add. However I don't use Gambas so this is only a guess. But I would suggest that you look the features available to add elements.
 
Old 05-19-2006, 01:10 PM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Original Poster
Rep: Reputation: 65
thanks for your reply graemef. I've literally read everything in the documentation on arrays and element assignment, and according to the documentation, I'm not doing anything wrong.

I think I might try to assign the element values within the class the array is defined in.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gambas bong.mau Programming 0 05-07-2006 10:03 AM
JavaScript:: alert(node) shows null, but node != null taylor_venable Programming 1 05-01-2006 09:51 PM
fstab-sync: error: libhal_ctx_init_direct: (null): (null) rpz Linux - Hardware 1 11-01-2005 05:42 AM
Javascript error "is null or not an object" apt Programming 2 03-28-2005 06:14 AM
Event driven object-to-object: C++ template class mecanism ( NOT STL or STDC++) bretzeltux Programming 2 12-23-2003 02:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration