Sha256: d21caf66f2011c4d238d356f22f73b9e3d12d8ae1580beaec2fee42885a751f2

Contents?: true

Size: 1016 Bytes

Versions: 5

Compression:

Stored size: 1016 Bytes

Contents

#include "<%= @namespace.header %>"

#include "lua_cpp_helper.h"

using namespace <%= @namespace.name %>;

<% if @namespace.members; @namespace.members.each do |function| %>

<%= function %>

<% end; end %>

// Register namespace


static const struct luaL_Reg <%= @namespace.name %>_functions[] = {
<%= indent(functions_registration, 2) %>,
  {NULL, NULL},
};

<% if @namespace.has_constants? %>
static const struct lua_constants_Reg <%= @namespace.name %>_namespace_constants[] = {
<%= indent(constants_registration, 2) %>,
  {NULL, NULL},
};
<% end %>

#ifdef DUB_LUA_NO_OPEN
int luaload_<%= @namespace.lib_name %>(lua_State *L) {
#else
extern "C" int luaopen_<%= @namespace.lib_name %>(lua_State *L) {
#endif
  // register functions
  luaL_register(L, <%= @namespace.name.inspect %>, <%= @namespace.name %>_functions);
<% if @namespace.has_constants? %>
  // register namespace enums
  register_constants(L, <%= @namespace.id_name.inspect %>, <%= @namespace.name %>_namespace_constants);
<% end %>
  return 0;
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dub-0.6.6 lib/dub/lua/namespace.cpp.erb
dub-0.6.5 lib/dub/lua/namespace.cpp.erb
dub-0.6.4 lib/dub/lua/namespace.cpp.erb
dub-0.6.3 lib/dub/lua/namespace.cpp.erb
dub-0.6.2 lib/dub/lua/namespace.cpp.erb