[Gambas-user] [Gambas Bug Tracker] Bug #903: Bash-like "source" command for gbs3
bugtracker at ...3416...
bugtracker at ...3416...
Mon Mar 21 10:31:37 CET 2016
http://gambaswiki.org/bugtracker/edit?object=BUG.903&from=L21haW4-
Comment #3 by Fabien BODARD:
You can use INCLUDE for that.
#!/bin/env gbs3
Private myVar as Integer
INCLUDE "DBDef.gbs"
MyConnectionFunction
You can use the CLASS / END CLASS keywords to define a class too.
So to create a reusable class you have to define it in the imported file for example.
===============MyClassFile.gbs============
CLASS MyClass
Static Public Function OpenDB(dbname as string)
End
END CLASS
========================
==========myscript.gbs==========
IMPORT "MyClassFile.gbs"
MyClass.OpenDB("mydb")
========================
Be carefull with IMPORT as it just insert the file content.
More information about the User
mailing list