Giter VIP home page Giter VIP logo

gm_stringtable's Introduction

gm_stringtable

Build Status
A module for Garry's Mod that provides interfaces to interact with stringtables from VALVe's engine.

Compiling

The only supported compilation platform for this project on Windows is Visual Studio 2017 on release mode. However, it's possible it'll work with Visual Studio 2015 and Visual Studio 2019 because of the unified runtime.

On Linux, everything should work fine as is, on release mode.

For macOS, any Xcode (using the GCC compiler) version MIGHT work as long as the Mac OSX 10.7 SDK is used, on release mode.

These restrictions are not random; they exist because of ABI compatibility reasons.

If stuff starts erroring or fails to work, be sure to check the correct line endings (\n and such) are present in the files for each OS.

Requirements

This project requires garrysmod_common, a framework to facilitate the creation of compilations files (Visual Studio, make, XCode, etc). Simply set the environment variable 'GARRYSMOD_COMMON' or the premake option 'gmcommon' to the path of your local copy of garrysmod_common.

We also use SourceSDK2013. The links to SourceSDK2013 point to my own fork of VALVe's repo and for good reason: Garry's Mod has lots of backwards incompatible changes to interfaces and it's much smaller, being perfect for automated build systems like Azure Pipelines (which is used for this project).

gm_stringtable's People

Contributors

danielga avatar gigte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gigte yogpod

gm_stringtable's Issues

Linux binary.

Would you add a Linux compiled version to /releases ?

Prebuilt linux binary not working

lua require "stringtable2"
addons/xlib/lua/xlib_extended/sh_devcommand.lua:71: error loading module 'stringtable2' from file 'gmsv_stringtable2_linux.dll':
/home/container/garrysmod/lua/bin/gmsv_stringtable2_linux.dll: undefined symbol: _ZN12SymbolFinder7ResolveEPKvPKcjS1_
stack traceback:
[C]: in function 'error'
lua/includes/modules/require.lua:65: in function 'searcher'
lua/includes/modules/require.lua:148: in function <lua/includes/modules/require.lua:131>
[C]: in function 'xpcall'
addons/xlib/lua/xlib_extended/sh_devcommand.lua:71: in function 'fn'
addons/xlib/lua/xlib_extended/sh_devcommand.lua:96: in function <addons/xlib/lua/xlib_extended/sh_devcommand.lua:93>
lua/includes/modules/concommand.lua:54: in function <lua/includes/modules/concommand.lua:49>

I solved this by adding IncludeScanning() to the premake workspace and recompiling

Issue with altering "networkstrings" string table

So I can view data in it but every time I attempt to remove or change anything it causes a crash.

I'm trying to help a friend of mine to change a networkstrings ID at will. So far I managed to make a wrapper that can add a network string into the networkstrings string table. However I'm having a hard time with removing a network string from the string table or altering the index of a network string.

Right now this is usable for making netstrings but won't let me specify the exact id to give to a net string. Aswell over time making multiple new netstrings would result in unused network strings.

I was hoping you can give me some advice on how to go about deleting netstrings, changing the ID of a netstring or changing the netstring associated with an ID.

This is the wrapper so far

if SERVER then
	require("stringtable")

	--	Prints the string currently associated with an ID( WORKING )
	function net.PrintNetString(id)
		print(stringtable.Get(19):GetString(id))
	end

	--	Prints every Net String into console( WORKING )
	function net.PrintNetworkStrings()
		local netstrings = stringtable.Get( 19 ):GetTable()
		print( netstrings )
		PrintTable( netstrings )
	end

	--	Add a Network String into the string table( WORKING )
	function net.AddNetString( str )
		local newStringID
		local sTable = stringtable.Get( 19 )
			sTable:Lock( false )				--	not sure if this is really doing anything
			newStringID = sTable:AddString( true, str )		--	not sure why it wants a bool????
			sTable:Lock( true )

		return newStringID	--	Return the new string ID
	end

	--	Does Nothing, table shows up unaltered when calling net.PrintNetworkStrings() and the index is unchanged when calling net.PrintNetString()
	function net.SetNetString( id, str )
		local sTable = stringtable.Get( 19 )
			sTable:Lock( false )
			sTable:GetString( id, str )
			sTable:Lock( true )
	end

	function net.DeleteNetString( id )	--Crashes immediately
		local sTable = stringtable.Get( 19 )
			sTable:Lock( false )
			sTable:DeleteString( id )
			sTable:Lock( true )
	end
else
	function net.Incoming( len, ply )
		local ID = net.ReadHeader()
		print( "Recived Net Message ID: ", ID )

		if net.Receivers[ ID ] then
			return net.Receivers[ ID ]( len, ply )
		end
	end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.