GModInterface

From GMod Wiki

Jump to: navigation, search
Patches.png Go to:
Development Tools


Merge.pngThis article has been tagged to be merged with GLuaModule. If you wish for the page to be handled differently, this can be disputed on the talk page. See more articles tagged to be merged here.
Comments: If these significantly overlap, or if GModInterface is severely out of date/deprecated, please see fit to edit/delete it


The GMod-Interface allows you to create Lua modules in C++.

You can download it from Google Code here: http://code.google.com/p/gmod-lua-interface/

You can browse SVN online here: http://gmod-lua-interface.googlecode.com/svn/trunk/

Purpose

The main reason you'd want to do this is to bind something like MySQL so you could use it in Lua.

Example

Here's how you use the dll in Lua

// Opens the dll if it hasn't already been opened
// The dll should be in lua/includes/modules/ and should be called gm_<modulename>.dll
require( "example" )
 
 
 
// Test the functions we added..
 
MsgBox("Hello there!!");
 
 
 
 
// The module table we added
 
PrintTable( my_module )
 
local var = my_module.GetVariable()
 
Msg("Var Is: \""..var.."\"\n");
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox