GithubHelp home page GithubHelp logo

gmod-module-base's Introduction

gmod-module-base

Technically everything you need is in include.

Example contains an example project. Running BuildProjects.bat requires premake4 (http://industriousone.com/premake).

The generated dlls should be placed in

garrysmod/lua/bin/

They should also be named appropriately:

gmsv_example_win32.dllserverside on windowsrequire( 'example' )
gmsv_example_linux.dllserverside on linuxrequire( 'example' )
gmsv_example_osx.dllserverside on osxrequire( 'example' )
gmcl_nutsack_win32.dllclientside on windowsrequire( 'nutsack' )
gmcl_example_osx.dllclientside on osxrequire( 'example' )

gmod-module-base's People

Contributors

garrynewman avatar potcfdk avatar robotboy655 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gmod-module-base's Issues

coroutines cause the generated modules to break

The modules either crash or return incorrect values.

http://facepunch.com/showthread.php?t=1260809&p=42916561#post42916561

Example:

require'example' -- [url]https://github.com/garrynewman/gmod-module-base/blob/master/example/src/gm_example.cpp[/url]
local var
local thread = coroutine.create(function() 
   var = TestFunction(123,321)
   ErrorNoHalt(TestFunction())
   coroutine.yield()
   var = TestFunction()
end)
print("thread",thread) --thread thread: 0xd713a598
print("before",var) --before nil
--  321
print("resume",coroutine.resume(thread),coroutine.status(thread)) --  resume true suspended
print("now",var) -- now 321
print("should be",TestFunction(321)) -- should be Thanks for the number - I love 321.000000!!
print("resume",coroutine.resume(thread),coroutine.status(thread)) -- resume true dead
print("now",var) --  now -2.9528447354403e+111
print("should be",TestFunction()) -- should be This string is returned```

Wrap additional methods from Lua 5.1 API

It's still not really feasible to stick with just ILuaBase for modules since it's missing some core Lua functionality. Specifically:

  • lua_callk
  • lua_concat
  • lua_createtable arguments
  • lua_error (erroring from the stack instead of a C-string)
  • lua_gc
  • lua_getfenv
  • lua_getinfo
  • lua_getlocal
  • lua_getstack
  • lua_getupvalue
  • lua_lessthan
  • lua_newthread
  • lua_push(v)fstring
  • lua_pushinteger
  • lua_replace
  • lua_resume
  • lua_setfenv
  • lua_setglobal
  • lua_topointer
  • lua_upvalueindex
  • lua_yield
  • luaL_loadfile
  • luaL_loadstring
  • luaL_where

"Unable to write file to..."

When using the development branch, if you try to run "premake5.exe vs2019" this error is printed:


C:\Users\Richa\Documents\GitHub\gmod-module-base-development\example>premake5.exe vs2019
** Warning: os.get() is deprecated, use 'os.target()' or 'os.host()'.
   @...GitHub\gmod-module-base-development\example\premake5.lua(3)

** Warning: os.is() is deprecated, use 'os.istarget()' or 'os.ishost()'.
   @...GitHub\gmod-module-base-development\example\premake5.lua(13)

** Warning: os.is() is deprecated, use 'os.istarget()' or 'os.ishost()'.
   @...GitHub\gmod-module-base-development\example\premake5.lua(14)

** Warning: os.is() is deprecated, use 'os.istarget()' or 'os.ishost()'.
   @...GitHub\gmod-module-base-development\example\premake5.lua(15)

** Warning: the flags value StaticRuntime has been deprecated and will be removed.
   Use `staticruntime "On"` instead
   @C function

Building configurations...
Running action 'vs2019'...
Error: unable to write file to 'C:/Users/Richa/Documents/GitHub/gmod-module-base-development/example/projects/windows/gmsv_example.sln'

Unknown CMake command "set_gmod_suffix_prefix".

On the dev branch

CMake Error at CMakeLists.txt:14 (add_subdirectory):
  The source directory

    C:/Users/user/Desktop/gmod-modules/include

  does not contain a CMakeLists.txt file.


CMake Error at natsunet/CMakeLists.txt:7 (set_gmod_suffix_prefix):
  Unknown CMake command "set_gmod_suffix_prefix".


-- Configuring incomplete, errors occurred!
See also "C:/Users/user/Desktop/gmod-modules/CMakeFiles/CMakeOutput.log"

Loading example module broken on linux

Silly that you even have to rename the .so to a .dll for it to even find the module which is a bug of its own. It finds the module but then presents me with this error:

Module name: gmcl_example_linux.dll

[ERROR] addons/mca/lua/autorun/client/cl_test.lua:4: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - addons/mca/lua/autorun/client/cl_test.lua:4

The file is not found using gmcl_example_linux.so
Same with development branch.

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.