This function opens an SQLite database or creates a new one.
- UserPointer sqlite_open( string filename )
- filename - This is the filename of the previously saved database or filename for the new database
For a larger example, check the general SQLite database example from the wiki tutorials.
This example shows how to open to a database with a single command. The command loads a previously saved database from 'database.db', or if the file doesn't exist, creates a new database.
- function onConsoleInput( cmd, text )
- if ( cmd == "connectsql" )
- local db = sqlite_open( "database.db" );
- print( "Opening an SQLite database..." );
- return 1;
The call onConsoleInput was used in in this example. More info about it in corresponding page.
These functions are provided by the official module lu_sqlite.